[invokers] Reference the parent popover/dialog
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 4.5k
- Forks
- 226
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 4
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the issue's HTML example and the proposed command/commandfor values. Compare the requested nearest-ancestor behavior for dialog and popover commands with the existing invoker model, then determine the standards change needed and how completion would be validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100