-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Components: Extend experimental v2 CustomSelectControl to allow custom popover props and hide label #57703
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
Conversation
We need a means of ensuring that the select popover has sufficient z-index to render above controls below it in the inspector. Additionally, we want to be able to avoid visually rendering the select's label.
633cd11
to
e9dbd95
Compare
Continuing the conversation from #57331 (comment), the new version of Still, we can gather the requirements that consumers may encounter, which may inform the next steps in shaping the component's public APIs. Looking at the list of suggested additions:
This makes sense, although we need to be careful when doing so since control labels are actually quite an important accessibility feature (@andrewhayward )
What is the reason for exposing the whole |
Definitely! I'm curious about the best way to handle it since the |
Thanks for the extra information @ciampo and @brookewp 👍
I take it this meant "outside of the components package?" Otherwise, the editor is exactly where I want to use it 🙂
This PR followed the approach used in the
I found in #57331 that I needed to tweak the popover's It appeared that the Ariakit component would recalculate and apply the z-index as an inline style making it tough to fix that issue via CSS alone. |
Yep, I definitely meant "components package" 🤦
Thank you for the extra context! We'll keep it into account when iterating on
That's interesting. At least, we are probably going to replicate the same In the longer term, I would love for popover-based UI to move away from hardcoded z-index, and just be based on receiving a dynamic value (ie. latest popover-based component gets the higher z-index) |
@aaronrobertshaw Do you believe it's a bug or something that could be addressed in Ariakit? If you can create an issue on https://github.com/ariakit/ariakit/issues, I'd love to take a better look. Right now, at the moment it opens, the popover wrapper element will replicate the computed popoverProps={{
- wrapperProps: { style: { zIndex: 1000000 } },
+ style: { zIndex: 1000000 }
}} Or even this: <CustomSelect
popoverProps={{ className: "class-with-higher-z-index" }}
/> |
I agree (assuming you meant "latest popover-based component that opens gets the highest z-index"). That's akin to how the native |
Thanks for the nudges in the right direction @diegohaz 👍
No, I don't think there's a bug in Ariakit. By the looks of it, it's working as expected.
Both the suggestions work, thank you. In hindsight I was probably just distracted by the inline style for the z-index on the wrapper and targeted overriding that not appreciating that the wrapper would replicate the computed z-index. All these approaches still require the ability to pass the @brookewp and @ciampo, if the v2 CustomSelect components are still under active development would you prefer I close this PR for now? I have an alternate PR up using a dropdown until we can make the switch to the new select control. |
The component is not ready yet. If you need to implement that piece of functionality soon, using a dropdown sounds like a good option. We could close this PR and put #57331 on hold. As soon as v2 is ready, you should be able to pick it up again. Sorry for the disruption! |
Not a problem at all given it turns out we had an obvious alternative all along 😄 I'll close both PRs for now. I have the feeling the block style variation sands will shift again before the time comes to reimplement the UI. |
Related:
What?
Adds two new props to the experimental v2 CustomSelectControl;
hideLabelFromVision
andpopoverProps
. The experimental control is also exported as a private API.Why?
The mockups for the updated block style variation controls require adding some things such as color indicators and custom styles to the proposed select's options. The experimental CustomSelectControl v2 is the best bet for achieving this design.
To do that though, we need the ability to visually hide a label and customize the select's popover.
How?
VisuallyHidden
if the newhideLabelFromVision
prop istrue
popoverProps
value with the components existing values forgutter
,sameWidth
andstore
then passes those through to the underlying componentsTesting Instructions
CustomSelectControl v2
pageScreenshots or screencast