Open
Bug 1727964
Opened 4 years ago
Updated 1 year ago
`HTMLElement.blur()` can not cancel all the focus in sub tree
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Tracking
()
UNCONFIRMED
People
(Reporter: 709922234, Unassigned)
Details
(Whiteboard: [domcore-bugbash-triaged])
Attachments
(1 file)
|
50.47 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:93.0) Gecko/20100101 Firefox/93.0
Steps to reproduce:
visit: https://codepen.io/mantou132/pen/PomMMbj
document.body.innerHTML = `
<my-ele>
<div tabindex=1>foucesable</div>
</my-ele>
`
document.querySelector('div').focus();
document.querySelector('my-ele').blur();
document.body.append(`current active element: ${document.activeElement.tagName}`);
Actual results:
current active element: DIV
Expected results:
current active element: BODY
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Updated•4 years ago
|
Component: DOM: Core & HTML → DOM: UI Events & Focus Handling
Comment 1•4 years ago
|
||
Firefox 71 behaves the same and Chome and Edge also behave the same.
However, Safari reset the focus to Body.
Severity: -- → S3
Priority: -- → P3
In custom elements, it is useful to be able to cancel the focus of the sub tree, for example:
<my-form>
#shadow-root
<form-item>
#shadow-root
<input>
<form-item>
<my-form>
Comment 3•1 year ago
|
||
Chrome changed their behavior that they reset the focus to Body as Safari. We still need to see what the spec says.
Whiteboard: [domcore-bugbash-triaged]
Updated•1 year ago
|
Flags: needinfo?(sefeng)
You need to log in
before you can comment on or make changes to this bug.
Description
•