Repository navigation
Description
Steps to reproduce
Flutter 3.47.0 stable (framework 4cf2416, engine 5f77625), web, --wasm (also seen with dart2js), semantics enabled (SemanticsBinding.instance.ensureSemantics()), Chrome desktop with a real mouse.
- A
TextFieldis focused and the user is typing. - Next to it is an
IconButtonthat clears the field (for example a search ✕). It is visible only while the field has text. - Click the ✕ with the mouse.
- Type again without clicking anything.
Expected results
The field keeps focus and the new keys are inserted, as on every other platform and with semantics off.
Actual results
Flutter still shows the field focused (focused underline, FocusNode.hasFocus == true, EditableText keeps the connection), but document.activeElement is <flutter-view>. The keys go nowhere. This happened in 10 of 10 runs in a Playwright trace with real Chrome pointer and keyboard input.
Analysis
EnginePlatformDispatcher._addNavigationFocusHandlerinstalls a capture-phaseclicklistener._isLikelyAssistiveTechnologyActivation→_isIntegerCoordinateNavigationtreats a click whoseclientX/clientYare whole numbers on arole="button"semantics node as an assistive-technology activation and callsfocusWithoutScroll()on the button.
Chrome reports whole-numberclientX/clientYfor ordinary mouse clicks at DPR 1, so every real mouse click on a button counts as an AT activation. AmousedownpreventDefault()does not help, because the focus is moved by thisclickhandler.- The focus move blurs the semantics
<input>.SemanticsTextEditingStrategy.disable()then callsviewManager.safeBlur(activeDomElement), which defers_transferFocusToViewRootwithFuture(() => ...). - The framework's next frame still reports the text field as focused, so editing is re-enabled on the input. Then the stale deferred
safeBlurruns and moves the focus to the view root. Engine text editing is now off, but the framework still thinks the field is focused, and nothing reconnects it.
A related trigger with the same symptom: if a tooltip shows or hides while a semantics text field is focused (for example a different IconButton slides under the still pointer after the ✕ disappears), the route's semantics subtree is wrapped or unwrapped. That moves the focused <input> in the DOM, so it blurs, focus ends on <body>, and the keys are lost.
Pressing Backspace instead of clicking the ✕ never reproduces it (5 of 5 passed).
Workaround in our app
A capture-phase focusout listener for input/textarea[data-semantics-role="text-field"]. After Timer.run plus one frame, if the framework's primary focus is still that EditableText but document.activeElement is not its input, it calls unfocus() and, on the next frame, requestKeyboard() (with an explicit scheduleFrame()).
Suggestion
- Do not use whole-number click coordinates as an AT signal. Desktop Chrome mouse clicks at DPR 1 always have whole-number coordinates.
PointerEvent.pointerType,detail == 0, or the absence of a precedingpointerdownare more reliable signals. - Cancel or re-check the deferred
safeBlurif the element is re-enabled or focused again before the timer runs.
Activity
mbcorona commentedon Nov 3, 2026
Thanks @ichorid for the analysis.
Confirmed from source (EnginePlatformDispatcher): a whole number coordinate click on a
button or role=button is treated as assistive tech activation and focuses it, pulling
focus off the field. The code comment even says real clicks are "often fractional".
Related to #195289 and #195291.