-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Don't delegate focus when the shadow host is an ancestor of the currently focused area #5039
Changes from all commits
bc82525
11e8717
a96a60e
f76a1f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74003,7 +74003,7 @@ END:VCARD</pre> | |
|
||
<dd> | ||
|
||
<p>Let <var>new focus target</var> be the <code>Document</code>'s <span>viewport</span>.</p> | ||
<p>Set <var>new focus target</var> to the <code>Document</code>'s <span>viewport</span>.</p> | ||
|
||
</dd> | ||
|
||
|
@@ -74034,18 +74034,30 @@ END:VCARD</pre> | |
|
||
<dd> | ||
|
||
<p>If <var>focus trigger</var> is "<code data-x="">click</code>", then let <var>possible focus | ||
delegates</var> be the list of all <span>click focusable</span> <span data-x="focusable | ||
area">focusable areas</span> whose <span>DOM anchor</span> is a descendant of <var>new focus | ||
target</var> in the <span>flat tree</span>.</p> | ||
<ol> | ||
<li>If <var>new focus target</var> is a <span>shadow-including inclusive ancestor</span> of | ||
the <span>currently focused area of a top-level browsing context</span>'s <span>DOM | ||
anchor</span>, then set <var>new focus target</var> to null.</li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit ambiguous how to interpret "stop these steps" here. I think the easiest thing to do will be to just nest the other three steps under an "Otherwise:" step 2. I'll make that change since it's easy enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! |
||
|
||
<p>Otherwise, let <var>possible focus delegates</var> be the list of all <span | ||
data-x="focusable area">focusable areas</span> whose <span>DOM anchor</span> is a descendant | ||
of <var>new focus target</var> in the <span>flat tree</span>.</p> | ||
<li> | ||
<p>Otherwise:</p> | ||
|
||
<p>Set <var>new focus target</var> to the first <span>focusable area</span> in <span>tree | ||
order</span> of their <span data-x="DOM anchor">DOM anchors</span> in <var>possible focus | ||
delegates</var>, or null if <var>possible focus delegates</var> is empty.</p> | ||
<ol> | ||
<li>If <var>focus trigger</var> is "<code data-x="">click</code>", then let <var>possible | ||
focus delegates</var> be the list of all <span>click focusable</span> <span | ||
data-x="focusable area">focusable areas</span> whose <span>DOM anchor</span> is a | ||
descendant of <var>new focus target</var> in the <span>flat tree</span>.</li> | ||
|
||
<li>Otherwise, let <var>possible focus delegates</var> be the list of all <span | ||
data-x="focusable area">focusable areas</span> whose <span>DOM anchor</span> is a | ||
descendant of <var>new focus target</var> in the <span>flat tree</span>.</li> | ||
|
||
<li>Set <var>new focus target</var> to the first <span>focusable area</span> in <span>tree | ||
order</span> of their <span data-x="DOM anchor">DOM anchors</span> in <var>possible focus | ||
delegates</var>, or null if <var>possible focus delegates</var> is empty.</li> | ||
</ol> | ||
</li> | ||
</ol> | ||
|
||
<p class="note">For <span data-x="sequentially focusable">sequential focusability</span>, the | ||
handling of <span data-x="shadow host">shadow hosts</span> and <span>delegates focus</span> is | ||
|
There was a problem hiding this comment.
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 quite right. You can have two elements that are descendants of each other without shadow trees, in those cases,
focus()
should be able to move the focus to the outer / ancestor node which is a simple ancestor of the currently focused element.e.g.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it does move the focus to the div, because div is not a shadow host that delegates focus. These steps are within the "If new focus target is a shadow host whose shadow root 's delegates focus is true" clause.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right.