Bug 217350

Summary: Text input element does not scroll into view when setting focus and selection
Product: WebKit Reporter: Adam Reineke <adam>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: adam, cdumez, ddkilzer, megan_gardner, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Min repro for the bug
none
Repro without step attribute none

Adam Reineke
Reported 2020-10-05 16:18:47 PDT
Created attachment 410580 [details] Min repro for the bug The input element receives focus but does not scroll into view if you call focus() and a selection API on an input element with the step attribute (except when the exact text selection was already set). Repro: 1. input type=text with the step attribute set. Note: Any value for step seems to work. I use the empty string. 2. Scroll input off-screen 3. Send focus and set selection at the same time. - Note: Setting the selection via any of the selection APIs hits the bug: .select(), .selectionStart and .selectionEnd together, or .setSelectionRange(). - Note: The selection being set must be different than the current selection to hit the bug. - Note: If you click one of the select buttons on the left twice in a row, the input will scroll into view because text selection was unchanged. Version: Tested in Safari 14.0 (15610.1.28.1.9, 15610) and Safari Technology Preview (Release 113, Safari 14.0.1, Webkit 15610.2.3.1). I expect it also happens in Safari 13 based on the bug report I was investigating when I reduced to this min-repro. Tested on Mac desktop only. Test file attached with min repro.
Attachments
Min repro for the bug (3.36 KB, text/html)
2020-10-05 16:18 PDT, Adam Reineke
no flags
Repro without step attribute (3.18 KB, text/html)
2020-10-06 15:05 PDT, Adam Reineke
no flags
Radar WebKit Bug Importer
Comment 1 2020-10-05 17:10:27 PDT
Adam Reineke
Comment 2 2020-10-05 18:11:58 PDT
FYI, originally discovered on Salesforce.com but there is no public URL for that repro. No repro in Chrome 85.
Adam Reineke
Comment 3 2020-10-06 15:04:13 PDT
This actually doesn't require the step attribute.
Adam Reineke
Comment 4 2020-10-06 15:05:13 PDT
Created attachment 410698 [details] Repro without step attribute A simpler repro that doesn't include the step="" attribute on the input.
Note You need to log in before you can comment on or make changes to this bug.