Bug 256929 - setSelectionRange will reset the m_latestFocusTrigger variable, causing the subsequently focused element to match the :focus-visible selector
Summary: setSelectionRange will reset the m_latestFocusTrigger variable, causing the s...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-05-17 17:07 PDT by 2471314
Modified: 2023-10-31 23:09 PDT (History)
6 users (show)

See Also:


Attachments
test case (1.19 KB, text/html)
2023-05-17 17:07 PDT, 2471314
no flags Details
Like Element::focusForBindings, set the trigger to FocusTrigger::Bindings (950 bytes, patch)
2023-05-17 17:42 PDT, 2471314
rniwa: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.