-
Notifications
You must be signed in to change notification settings - Fork 219
Description
The "close" command will almost always be used to close the dialog that the close button is in.
Similarly a button set to "hide-popover" will, a great deal of the time, be nested inside the popover that it hides.
Needing to reference a unique id makes reuse awkward. If I reuse the same UI element on the same page by copy/pasteing some HTML, needing to look through the markup and update every id and commandfor is laborious and error-prone.
It would be useful to be able to refer to the nearest ancestor popover/dialog element, rather than only being able to reference an id, which needs to be unique every time.
Something like commandfor="parent", commandfor="closest", commandfor="this" or commandfor="self"
e.g.
<dialog>
<h2>Dialog</h2>
<button command="close" commandfor="closest">Close</button>
</dialog>If the command is set to "close", it would find the nearest ancestor dialog. If command is set to "hide-popover" it would reference the nearest ancestor popover.
I think this would have been nice default behaviour if the commandfor attribute was omitted, but if that's not possible this would at least be better than nothing.
For certain UI components, like a large nested menu, for example, many buttons, each with a command and commandfor might be used, which makes referencing ids particularly onerous.