[fix]: fill codes across auto-advancing one-character inputs

AN
5d ago
+446-47

why

  • verification forms often use one input per digit and move focus to the next box on each input event
  • fill() and type() sent the whole code in one Input.insertText, so only the first digit landed and the rest was dropped by maxlength="1"
  • act() hits the same path: the model picks the first box and calls fill with the full code

Fixes #3235

what changed

  • insertText() in Locator now 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.ts cover fill() and type() following focus, stopping when focus stays put or leaves inputs, and the deadline on the focus wait
  • new locatorCodeInputs integration suite covers maxlength="1", size="1", adjacent inputs, number inputs, focus moved in requestAnimationFrame, re-rendered inputs, inputs in a shadow root, an act() 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, and locatorInputMethods pass 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 requestAnimationFrame with a timer fallback.