[fix]: fill codes across auto-advancing one-character inputs
AN
5d ago+446+446+012345678901234567890123456789-47-47-01234567890123456789
why
- verification forms often use one input per digit and move focus to the next box on each
inputevent fill()andtype()sent the whole code in oneInput.insertText, so only the first digit landed and the rest was dropped bymaxlength="1"act()hits the same path: the model picks the first box and callsfillwith the full code
Fixes #3235
what changed
insertText()inLocatornow checks whether the target looks like one box of a code form (maxlength="1",size="1", or a run of three or more adjacent same-type inputs). If so it inserts one character at a time while focus keeps moving forward, then inserts whatever is left in one step. Ordinary fields still get a single insertion.- focus is tracked by index among the inputs in the element's document or shadow root, so forms that re-render their inputs after each digit still work. The wait covers focus moves scheduled with
requestAnimationFrame, with a timer fallback. fill()keeps the prepared handle alive until the text is inserted so the check does not resolve the node a second time
test plan
- unit tests in
locatorActions.test.tscoverfill()andtype()following focus, stopping when focus stays put or leaves inputs, and the deadline on the focus wait - new
locatorCodeInputsintegration suite coversmaxlength="1",size="1", adjacent inputs, number inputs, focus moved inrequestAnimationFrame, re-rendered inputs, inputs in a shadow root, anact()run with a stub model, and regression cases for a full-length code field and adjacent ordinary fields keeping a single insertion - oxfmt, oxlint, and typecheck pass for the extension and SDK;
locatorCodeInputs,locatorFill, andlocatorInputMethodspass locally
Summary by cubic
Fixes fill() and type() so verification codes spread across one-character inputs that move focus forward after each digit. Previously the full code was inserted at once, so only the first digit landed in boxes with maxlength="1"; act() hit the same path since it calls fill. Ordinary inputs still get a single insertion. Fixes #3235.
Bug Fixes
- Detects code inputs via
maxlength="1",size="1", or a run of three or more adjacent same-type inputs, inserting one character at a time while focus advances. - Tracks focus by input index so forms that re-render their inputs per digit still work, including inside shadow roots, and waits for focus moves scheduled with
requestAnimationFramewith a timer fallback.