Skip to content

What should happen if a popover is shown during the hide of another? #12355

@jakearchibald

Description

@jakearchibald

What is the issue with the HTML Standard?

During the hide of popovers, it's possible due to things like beforetoggle, focus, and blur events, to attempt to show another popover.

What should happen here? It seems like the current spec (prior to #12345) sometimes tries to immediately hide, without events, the new popover. Although, it's inconsistent:

av1.mp4

What should we do?

Option 1: Prevent showing these popovers

This is quite a change from current behaviour, but it feels less likely to cause infinite loops, and it's simpler than showing-then-hiding. Although, I'm sure there's some reason why the current design went with showing-then-hiding.

Option 2: Show, but immediately hide the new popover without events

This is what I tried to do in #12345, because I thought it was the intent of the current spec, but I think I'm missing some of the 'without events' cases. Also, I'm only looking at one stack, which doesn't seem right (same goes for the old/current spec).

Given there are side-effects to showing & hiding a popover, this seems really complex and likely to have bugs.

Option 3: Just let the new popovers show

This is a simpler version of option 2. It might result in some unusual states, because the original hide algorithm may end up hiding the new popover anyway, but it's simpler in some ways because we don't try and do anything special.


I feel like option 1 is the right answer here. I think I'd just set a number on the document like "popover hiding depth" which increments at the start of a hiding operation, and decrements after it. If this is > 0 and there's a request to show a auto or hide popover, it throws.

Thoughts @mfreed7 @keithamus @lukewarlow @bramus?

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: popoverThe popover attribute and friends

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions