Skip to content

Hint popovers can't be the "topmost open popover ancestor" of dialog elements #11008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Gingeh opened this issue Feb 7, 2025 · 7 comments · May be fixed by #11253
Open

Hint popovers can't be the "topmost open popover ancestor" of dialog elements #11008

Gingeh opened this issue Feb 7, 2025 · 7 comments · May be fixed by #11253
Labels
topic: dialog The <dialog> element topic: popover The popover attribute and friends

Comments

@Gingeh
Copy link

Gingeh commented Feb 7, 2025

What is the issue with the HTML Standard?

Step 15 in "show popover", step 12 in the dialog.show() method steps and step 20 in "show a modal dialog" will all return null because "topmost popover ancestor" and "nearest inclusive open popover" both require the popover state to be "auto".

This goes against the behaviour expected by WPT (e.g. https://wpt.live/html/semantics/popovers/popover-top-layer-nesting-hints.html) and the behaviour of all major implementations.

@Gingeh
Copy link
Author

Gingeh commented Feb 8, 2025

From reading the chromium implementation I believe the problem is that step 9.4.4 in "topmost popover ancestor" is missing the condition that okNesting is also true if isPopover is false (source), without that condition non-popover elements (i.e. dialog elements) are treated as if they were "auto" popovers and are disallowed from being descendants of "hint" popovers.
Another problem is that "nearest inclusive open popover" seemingly hadn't been updated to allow "hint" popovers.

@Gingeh Gingeh changed the title "topmost popover ancestor" ignores "hint" popovers Hint popovers can't be the "topmost open popover ancestor" of dialog elements Feb 8, 2025
@annevk annevk added topic: dialog The <dialog> element topic: popover The popover attribute and friends labels Feb 25, 2025
@annevk
Copy link
Member

annevk commented Feb 25, 2025

cc @mfreed7 @nt1m @josepharhar

@mfreed7
Copy link
Contributor

mfreed7 commented Feb 25, 2025

Are you sure the problem doesn't all just boil down to "nearest inclusive open popover" not including hint at step 2.1? The "topmost popover ancesor" algorithm does seem to handle hints, e.g. step 9.4.4.

@Gingeh
Copy link
Author

Gingeh commented Feb 26, 2025

@mfreed7

Are you sure the problem doesn't all just boil down to "nearest inclusive open popover" not including hint at step 2.1? The "topmost popover ancesor" algorithm does seem to handle hints, e.g. step 9.4.4.

My comment about "topmost popover ancestor" isn't about it handling hints but specifically about it not allowing dialog elements to be nested within hint popover ancestors.

Step 9.4.4 currently only sets okNesting if the descendant is "hint" or the ancestor is "auto", this translates to "anything can be nested within auto popovers but only hints can be nested within hints".
Chromium's implementation also sets okNesting if the ancestor is not a popover (i.e. a non-popover dialog), this means dialogs can be nested within either type.

See the following table for a more visual reference, the "topmost popover ancestor" steps say the "?" should be "No" while Chromium and WPT say it should be "Yes".
Image

The note above those steps also suggests it should be a "Yes":

If the provided element is a top layer element such as a dialog which is not showing as a popover, then topmost popover ancestor will only look in the node tree to find the first popover.

@Gingeh
Copy link
Author

Gingeh commented Apr 4, 2025

For some extra motivation: this non-spec behaviour is implemented in Chromium, Webkit, Firefox and Ladybird, in addition to being expected by WPT

@Gingeh
Copy link
Author

Gingeh commented Apr 23, 2025

"nearest inclusive target popover for invoker" also needs to be updated to accept "hint" popovers to match existing light dismissal implementations.

@keithamus keithamus linked a pull request Apr 23, 2025 that will close this issue
6 tasks
@keithamus
Copy link
Contributor

On the one hand, it's probably not a good idea for developers to open a modal dialog inside of a hint popover. I imagine that would be quite disruptive. On the other hand, without this provision, should developers do such a thing we'd be back to the same type of issues described in #9998. So I think the change @Gingeh describes is warranted.

Though a small aside; I think Webkit and Firefox pass this WPT due to a lack of support for "hint" popovers. So it is perhaps coincidental for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: dialog The <dialog> element topic: popover The popover attribute and friends
Development

Successfully merging a pull request may close this issue.

4 participants