[invokers] add some way to toggle a popover without considering interest state
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 4.5k
- Forks
- 226
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 4
Description
Consider the following example where both an interestfor and commandfor target the same popover:
<button
interestfor="my-popover"
commandfor="my-popover"
command="toggle-popover"
>?</a>
<div id="my-popover" popover="hint">Popover content</div>
in this example, clicking the button hides the popover, if clicked again it shows it but gets light dismissed on hovering the button again. It would be nice if we could have this work such that clicking the button makes the popover persist so that the user does not have to continue hovering over the button. (And can then dismiss the popover by clicking the button again).
I would like to propose either:
- Changing the existing behavior:
toggle-popovershould not consider popovers shown byinterestforwhen deciding the toggle state, and losing interest should not clear an explictly opened popover (whether viatoggle-popover/show-popoverin HTML or the equivalent in JS).- I think this is preferable as I don't see how the current behavior is useful to either developers or users
- Adding a new value and state to popovers (all names to be bike-shedded):
show-persistent-popoverwhich shows a popover and prevents losing interest from the popover- and an equivalent JS api
.showPopover({ preventDismissOnInterestLoss: true })
- and an equivalent JS api
hide-persistent-popoverwhich hides a popover that was shown viashow-persistent-popoverbut doesn't hide a popover which is shown due to interest- and an equivalent JS api
.hidePopover({ allowInterestToContinueShowing: true })
- and an equivalent JS api
toggle-popover-persistentwhich is a combination of the above properties in the same way astoggle-popover
Just to clarify what the intended user flow would be:
- Initially the popover is hidden
- The user hovers the button and the popover is shown due to interest
- The user clicks the button, this causes the popover to persist (not be hidden as current behavior)
- The user can freely move their pointer around, the popover will persist (and hovering the button should not cause an implicit dismiss due to interest loss)
- The user clicks the button again which causes the popover to no longer be persistent and will be light dismissed when the user stops hovering the button
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 by reading the existing popover, interestfor, and commandfor behavior described in the relevant Open UI specification sections. Trace how interest loss and toggle commands interact, then compare the proposed alternatives against the stated hover-and-click flow; done means a clear, agreed behavior or API design is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100