-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration to the Floating UI #743
Migration to the Floating UI #743
Conversation
6fa63a3
to
66a2983
Compare
@computed('_parentFinder.parentNode', '_renderInPlace', 'floatingElementContainer') | ||
get _floatingElementContainer() { | ||
const maybeContainer = this.floatingElementContainer; | ||
const renderInPlace = this._renderInPlace; | ||
let floatingElementContainer; | ||
|
||
if (renderInPlace) { | ||
floatingElementContainer = this._parentFinder.parentNode; | ||
} else if (maybeContainer instanceof Element) { | ||
floatingElementContainer = maybeContainer; | ||
} else if (typeof maybeContainer === 'string') { | ||
const selector = maybeContainer; | ||
const possibleContainers = self.document.querySelectorAll(selector); | ||
|
||
assert(`floatingElementContainer selector "${selector}" found ` | ||
+ `${possibleContainers.length} possible containers when there should be exactly 1`, possibleContainers.length === 1); | ||
|
||
floatingElementContainer = possibleContainers[0]; | ||
} | ||
|
||
return floatingElementContainer; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only part taken from the ember-popper
to process the floating element's container logic
const targetInsideAttachment = find('#attachment-focus-me') | ||
await focus(targetInsideAttachment) | ||
await waitUntil(() => { | ||
if (document.activeElement === targetInsideAttachment) return true | ||
|
||
focus(targetInsideAttachment) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes the "focus" event didn't work for the firs time that caused the flaky tests here
"@html-next/flexi-default-styles": "^2.2.0", | ||
"babel-eslint": "^10.1.0", | ||
"broccoli-asset-rev": "^3.0.0", | ||
"ember-cli": "~3.26.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no changes in the ember-cli
version, just sorting the devDependencies alphabetically
66a2983
to
60dd29f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registerApi is redundant because of autoUpdate middleware Introduction
@tylerturdenpants Hey, let me know if this looks good to you, we're wiling to get this addon up-to-date, let me know if you're open to sharing merge/release rights |
package.json
Outdated
"babel-plugin-filter-imports": "^4.0.0", | ||
"babel6-plugin-strip-class-callcheck": "^6.0.0", | ||
"broccoli-funnel": "^3.0.5", | ||
"ember-auto-import": "^2.6.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this (and the webpack
dependency) to avoid the error caused by the library import in the component
60dd29f
to
d01f569
Compare
@tylerturdenpants could you please take a look when you have time? Thank you! |
Hey @tylerturdenpants I've noticed the CI failed because of the outdated Node version on CI. I've changed the |
… not supported by ember-auto-import)
@tylerturdenpants I think because it's not under an organization, I can't increase your access. If you delete tylerturdenpants/ember-attacher I can transfer ownership |
@kybishop I have deleted the fork so try again! Hope this works 🤞 |
@tylerturdenpants seems like the only failing CI step now will be the
I think the "octanification" is out of this PR's scope and should be implemented separately. Maybe it makes sense to mark the |
@kybishop one last thing. I would appreciate if you could also transfer NPM admin to me? Tbh, if you want to do all the previous requests with ember-popper, I can take that off your plate. Thank you 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we octanify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to octane edition 🙌
.github/workflows/ci.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop 3.12 support and 3.26 in its place if it all works out. Update the Readme of course 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Does it make sense to use 3.28
as an LTS one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the Readme of course
Btw, could you please update the "About" section to fix the demo app URL?
01b1bb4
to
e029fb3
Compare
@pzubar Should we also have a little guide in README perhaps on how to upgrade to 2.0? Like list out breaking API changes |
@krasnoukhov great idea! I've added a little guide with a link in README. |
This PR migrates the ember-attacher from Popper to Floating UI.
It also removes the
ember-raf-test-waiter
in favour of a more modern way to wait for the floating element positioning in the tests (see https://github.com/emberjs/ember-test-waiters).Motivation
The floating-ui already has its motivation described on the official website:
The Floating UI is actively supported by the organization that created the Popper library.
Migration
From the official migrate guide :
Floating UI forked Popper 2 and shares a lot of similarities. While the main external positioning function changed, many other parts of the API are similar.
I could provide the addon's own migration guide if the contributors' team agree to migrate/upgrade to the Floating UI.
What do you think about this proposal? I'll be happy to hear your thoughts.