Closed mfreed7 closed 2 months ago
First, it doesn't connect popovers in the same way that popovertarget does (nesting plus keyboard behavior).
I don't fully understand what you're referring to but just wanted to say anything popovertarget does invoketarget should absolutely be doing and it's a spec bug if there's something missing.
showPopover
. We could also extend showModal()
to take {invoker}
... TAG did mention a desire to add invoke(action, invoker)
so maybe that should be the direction of travel?The Open UI Community Group just discussed Imperative invoker relationships
, and agreed to the following:
RESOLVED: add an option to showPopover() to declare the invoking element.
RESOLVED: invoketarget=popover should create the same relationships (e.g. nesting and keyboard behavior) that popovertarget=popover does. Behavior TBD for interesttarget attribute.
Oooh, thanks y'all.
For context: I raised this with Mason when exploring switching Bikeshed's info panels (showing information on dfn
and a
elements) to using popovers, so I could stop using the roving tabindex hacks to get good tabbing behavior. Unfortunately, you currently only get that focus behavior from a <button popovertarget>
, which meant I was SOL.
Being able to specify the invoker in the JS call will solve my problems, thanks!
@mfreed7 would popover.showPopover({invoker: anotherElement})
work if the popover is in one shadow root, and anotherElement
is in another? That would solve part of the issues with popoverTargetElement not working that way.
@mfreed7 would
popover.showPopover({invoker: anotherElement})
work if the popover is in one shadow root, andanotherElement
is in another? That would solve part of the issues with popoverTargetElement not working that way.
It certainly could, assuming we did not create an API to retrieve the invoker. Otherwise, we risk opening access to a shadow root via this mechanism.
This is two issues in one:
popover.showPopover({invoker: anotherElement})
and have that set the invoker relationship? Reminder: an invoker relationship allowspopover
to be "nested" insideanotherElement
's containing popover, and it also fixes up the keyboard tab order sopopover
comes just afteranotherElement
. Both of these happen automatically for<button popovertarget=popover>
.popovertarget
does (nesting plus keyboard behavior). Second, it doesn't have a proposed imperative API at all, that I know of.