Bug 252441

Summary: Always store user-exposed elements as dialog & popover previously focused elements
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: mike, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=252426

Description Tim Nguyen (:ntim) 2023-02-16 15:39:44 PST
Webkit sometimes store the UA shadow DOM of <input> element as previously focused elements, which fails focus restoration if input changes type.

There should be a common method to get the "exposed" focused element, and it should be used to store the previously focused element.

It should also be used here as well (in FrameView.cpp): https://github.com/WebKit/WebKit/commit/a728674047d7d348157d6e313ddcb9d9662c48c5 (the issue was that the code was trying to get the scroll margin of the UA shadow DOM instead of the input itself)
Comment 1 Radar WebKit Bug Importer 2023-02-23 15:40:16 PST
<rdar://problem/105855994>