Bug 256929

Summary: setSelectionRange will reset the m_latestFocusTrigger variable, causing the subsequently focused element to match the :focus-visible selector
Product: WebKit Reporter: 2471314
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, mifenton, rniwa, simon.fraser, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case
none
Like Element::focusForBindings, set the trigger to FocusTrigger::Bindings rniwa: review-

Description 2471314 2023-05-17 17:07:35 PDT
Created attachment 466388 [details]
test case

element.setSelectionRange() is used to modify the cursor position, if the element.focus() is called again subsequently, the focused element will incorrectly match the :focus-visible selector.
Comment 1 2471314 2023-05-17 17:42:27 PDT
Created attachment 466389 [details]
Like Element::focusForBindings, set the trigger to FocusTrigger::Bindings
Comment 2 Radar WebKit Bug Importer 2023-05-24 17:08:15 PDT
<rdar://problem/109803748>
Comment 3 Ryosuke Niwa 2023-06-05 13:09:30 PDT
Comment on attachment 466389 [details]
Like Element::focusForBindings, set the trigger to FocusTrigger::Bindings

Thanks for the patch but this patch lacks appropriate commit message & a test, both of which need to be added in order for this code change to land.
Comment 4 2471314 2023-06-20 02:23:49 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15092
Comment 5 EWS 2023-10-31 23:09:21 PDT
Committed 270043@main (3d85c92f718f): <https://commits.webkit.org/270043@main>

Reviewed commits have been landed. Closing PR #15092 and removing active labels.