-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add the portalContainerId in Select Future release #4328
Conversation
🦋 Changeset detectedLatest commit: 27d11ba The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9d51653
to
1199280
Compare
fef77c5
to
d7d234c
Compare
|
||
<Canvas of={SelectStories.PortalContainer} /> | ||
|
||
It is important to note that a `relative` position should be applied to container element that contains the portal, ie: |
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.
I'd say "not absolute" rather than "is relative", as it will explain it clearer without the need for an example since everything is relative by default.
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.
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.
Huh very curious, but do we want it to cut off..?
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.
I wouldn't cut it off as a default, but if someone wants to cut it off, I'm sure they can figure it out :) I think we could probably leave the advice off 😄
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.
We can remove it, but my thinking here is that this is a visual shorthand of how the portal container can effect the popover, instead of it just being on the body.
I'm less beholden to having the advice around relative at the bottom since the example code can be seen in the canvas anyway.
|
||
describe("Popover portal", () => { | ||
it("has accessible trigger controls", async () => { | ||
render(<SelectWrapper id="id--select" isOpen />) |
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 need to declare the id in these tests
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.
And they're outa here ⚾ 🌬️ Nice catch, some left overs of when I had some janky selectors in there
/** | ||
* Creates a portal for the Popover to the matching element id | ||
*/ | ||
portalContainerId?: string |
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.
I think instead of confining it to an id, we should expose the same api that we've given the Popover, which accepts portalContainer
as an element. This way, the consumer can use a ref if they wanted and do not require an id :)
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 was my suggestion to simplify the API for the most common use case
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.
I'm in two minds about this, but having just tested variations of consumer code, I suppose this will be easiest for the consumer since they don't need a useEffect
. Happy to go this way then :)
Co-authored-by: Geoffrey Chong <[email protected]>
Why
This is blocking adoption of the Select component in KAIO. Consumers were having issues with the select not having an expose portal prop.
What
portalContainerId
prop in futureSelect
Popover
primitive