-
Notifications
You must be signed in to change notification settings - Fork 15
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
use the new popover attribute/api for popovers #265
Comments
Yeah, but also: Switching to using the Popover API for the Menu component to a large degree removes the need for the menu component in the first place. It would be useful to extract floating and tabster into its own modifiers (see also https://github.com/hokulea/aria-voyager/blob/main/packages/ember-aria-voyager/package/README.md) This would make possible the following beautiful API for a menu component with pure HTML plus element modifiers: <button popovertarget='my-popover'>Open popover</button>
<menu popover id='my-popover' {{float}} {{tabster}}>
<button role='menuitem' >my menuitem</button>
</menu> popoverModifier can target the button with const float modify(element, ,positionalArguments, namedArguments) {
const referenceElement = document.querySelector(`[popovertarget='${element.id}']`) // with options to override in positionalArguments
…
} |
can or is it that dialogs can nest, and you'd popovers must be the top (no nesting). In any case, I'm still waiting for Baseline to give the go-ahead I would still want a component though... because wiring up id / target attributes between elements is error prone, and it's nice to have a component do that for me
I am a big fan of this. For floating, you kinda have to use a component for now though, because you need to anchor the floater to something (usually a button)
These were taken from https://github.com/CrowdStrike/ember-velcro as they're not keeping up with things at a pace I like (and they're cool with it) In particular, this FloatingUI wrapper still needs to be documented Here is an example usage, in the Popover component: https://github.com/universal-ember/ember-primitives/blob/main/ember-primitives/src/components/popover.gts#L216 Though, I will point out, that these components are usually pretty light. But I find the amount of ceremony involved with plain HTML (and to do it correctly, etc) to often be too much. I would like to write less when I'm working on apps.
|
Issue here for Documented Floating UI: #378 |
issue here for creating a tabster modifier: #379 |
yes, but also no! :) In the popover api I have great success utilizing that a popover is strictly tied to a button with popovertarget=element.id. See my example above with: modifier((element) => {
const referenceElement = document.querySelector(`[popovertarget='${element.id}']`)`
}) In my experience, this makes it possible to not need to wrap it in a component? 🎉 |
Yes, I have success using popovers inside popovers and dialogs. – especially for tooltips this is necessary. Works out of the box for most browsers, and a good polyfill for older versions. |
This is excellent news! Any word on when Safari will be included in the Baseline? is it worth it to wait? or should we go-ahead and start using native popover?
This is the ceremony that I like avoiding. This project should probably provide the primitives for folks to do what you want to do though -- and I would gladly accept a PR to enable that <3 Also, I should probably add to all the component docs answering "why a component" -- would be good to expose what is abstracted / why the component exists in the first place (also allowing smart folks (such as yourself!) to choose when it makes sense to use the underlying modifier primitives) |
anchorTo here (I renamed it): https://ember-primitives.pages.dev/5-floaty-bits/anchor-to.md |
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/popover
The text was updated successfully, but these errors were encountered: