Skip to content
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

Change focus delegate for dialog to use flat tree to find focusable descendant #11088

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dizhang168
Copy link
Contributor

@dizhang168 dizhang168 commented Feb 28, 2025

(See WHATWG Working Mode: Changes for more details.)


/interaction.html ( diff )

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the inline comments, I think this has a few other issues:

  • This only handles dialogs, whereas I thought we wanted to handle popovers as well (per Focus delegate algorithm doesn't consider elements assigned to slot #9245 (comment))?
  • Because this checks whereToLook instead of focusTarget, I think it does the wrong thing for dialogs that are shadow hosts. (Since shadow roots are never dialog elements).
  • Because we already have two special cases in this algorithm for focusTarget being a dialog element (step 6.2 and 6.3), and this is adding a third, I think we've reached the point where having a separate "dialog initial focus delegate" algorithm would be better than reusing the same one with branching. (Or maybe "dialog/popover initial focus delegate"?)

<li>
<p>If <var>whereToLook</var> is a <code>dialog</code>, let <var>treeOrder</var> be the
<span>flat tree</span>. Otherwise, let <var>treeOrder</var> be <span>tree order</span>.</p>
</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below, format single-paragraph list items as <li><p>...</p></li>, without extra linebreaks/whitespace around the start/end tags. (Matching nearby style.)

<var>whereToLook</var>'s <span data-x="descendant">descendants</span>, in <span>tree
order</span>:</p>
<var>whereToLook</var>'s <span data-x="descendant">descendants</span>, in
<var>treeOrder</var>:</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct. We don't want to always look at the DOM tree descendants, just changing the order. We want to look at the flat tree descendants, which are different than the DOM tree descendants. (IIUC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants