Skip to content

FilteringTextInputFormatter.allow breaks dead key composition on Flutter Web (Chrome) #189056

Closed

Description

@Azramis

Steps to reproduce

  1. Run the application in Chrome.
  2. Use a French AZERTY keyboard.
  3. Focus the TextField.
  4. Press the dead key ^.
  5. Press A (expected character: Â).

Expected results

The dead key composition should complete normally.

Since  is not allowed by the formatter in this example, the resulting character may be rejected, but Flutter should remain in a valid editing state and no assertion should be thrown.

Actual results

Flutter throws an assertion similar to:

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════

Assertion failed:
range.end >= 0 && range.end <= text.length
"Range end 5 is out of text of length 4"

Afterwards, text editing behaves incorrectly (cursor movement, other text fields, editing state).

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget { 
  const MyApp({super.key}); 
  
  @override 
   Widget build(BuildContext context) { 
     return const MaterialApp(
       home: Scaffold(
         body: Center(
           child: SizedBox(
             width: 300,
               child: TextField(
                 inputFormatters: [
                   FilteringTextInputFormatter.allow(
                    RegExp(r"[A-Z]"), 
                  ),
                ],
              ),
            ),
          ),
        ),
     );
   }
}

Screenshots or Video

dead-key-error.mp4

Logs

Logs
══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞═══════════════════════
The following assertion was thrown during method call
TextInputClient.updateEditingState:
Assertion failed:
file:///opt/flutter/packages/flutter/lib/src/services/text_input.dart:1182:7
range.end >= 0 && range.end <= text.length
"Range end 4 is out of text of length 3"

When the exception was thrown, this was the stack

call:
  MethodCall(TextInputClient.updateEditingState, [1, {text: AAA,
  selectionBase: 3, selectionExtent: 3, composingBase: 3,
  composingExtent: 4}])
═════════════════════════════════════════════════════════════════

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.38.7, on macOS 26.5.1 25F80 darwin-arm64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.3)
[✓] Chrome - develop for the web
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

Activity

  1. added
    in triagePresently being triaged by the triage team
    a: text inputEntering text in a text field or keyboard related problems
    c: crashStack traces logged to the console
    platform-webWeb applications specifically
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    fyi-webFor the attention of Web platform team
    and removed
    in triagePresently being triaged by the triage team
    on Jul 7, 2026
  2. mbcorona commented on Jul 7, 2026

    @mbcorona
    Member

    Hi @Azramis , Thanks for the detailed repro. Routing to the text input team.

  3. Azramis commented on Jul 7, 2026

    @Azramis
    Author

    Hi @mbcorona , no problem !
    Not sure if the issue came from text input, or if it's FilteringTextInputFormatter the culprit...

    Good luck Text Input Team fixing it 🤞

  4. added
    team-webOwned by Web platform team
    engineflutter/engine related. See also e: labels.
    P1High-priority issues at the top of the work list
    and removed
    fyi-webFor the attention of Web platform team
    on Jul 8, 2026
  5. 3 remaining items

  6. removed
    P1High-priority issues at the top of the work list
    on Aug 7, 2026
  7. flutter-triage-bot commented on Aug 9, 2026

    @flutter-triage-bot

    This issue is missing a priority label. Please set a priority label when adding the triaged-web label.

  8. added
    P1High-priority issues at the top of the work list
    triaged-webTriaged by Web platform team
    P2Important issues not at the top of the work list
    and removed
    P1High-priority issues at the top of the work list
    on Aug 12, 2026
  9. self-assigned this
    on Oct 9, 2026
  10. added
    P1High-priority issues at the top of the work list
    and removed
    P2Important issues not at the top of the work list
    on Oct 9, 2026
  11. added a commit that references this issue on Oct 14, 2026
    a4896ba
  12. github-actions commented on Oct 28, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on Oct 28, 2026
  14. added a commit that references this issue on Oct 29, 2026
    77f1ba3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consoleengineflutter/engine related. See also e: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions