Summary: | blur and focusout are not fired on document.activeElements when they are removed from the dom | ||
---|---|---|---|
Product: | WebKit | Reporter: | Rob Snow <rsnow> |
Component: | UI Events | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | Normal | CC: | ap, cdumez, ntim, rniwa |
Priority: | P2 | ||
Version: | Safari 15 | ||
Hardware: | Unspecified | ||
OS: | macOS 12 |
Description
Rob Snow
2022-08-09 13:45:01 PDT
This is the expected behavior. Thanks for the quick reply. However, I would argue this is not good behavior. It makes it very difficult to track and manage focus. For example, if you have a focus scope that contains focus within it, you need to know when focus leaves it so you can move the focus back inside. A common example of this is a Dialog. Right now, a blur event is not fired when the active element is removed from the dom, nor is a focus event fired on the body. So it's impossible to tell that focus moved outside of the scope. https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps I know this isn't specific about what happens when an active element becomes inert. However, I think it's reasonable to assume that an element becoming inert must lose focus. Therefore, it should go through the unfocusing steps, and then become inert. If this isn't the case, how would you recommend containing focus. For more info in other browser engines, see https://bugzilla.mozilla.org/show_bug.cgi?id=559561 As well as open issues in the living spec https://github.com/whatwg/html/issues/1195 https://github.com/whatwg/html/issues/3162 https://github.com/jsdom/jsdom/issues/2931 |