Skip to content

[material_ui] MenuAnchor corrupts Tab and F1 shortcut labels on JS #195003

Closed
flutter/packages
#13370

Description

@kevmoo

On JavaScript web targets (dart2js and ddc), MenuAnchor and MenuBar render unlocalized non-Unicode shortcut triggers such as SingleActivator(LogicalKeyboardKey.tab, control: true) and LogicalKeyboardKey.f1 as "Ctrl+\t" and "Ctrl+\u0801" instead of "Ctrl+Tab" and "Ctrl+F1", because menu_anchor.dart#L2632-L2637 checks logicalKeyId & LogicalKeyboardKey.planeMask == 0x0 and 32-bit JS bitwise & truncates planeMask (0x0ff00000000) to 0.

Proposed Fix

  • Fall back directly to trigger.keyLabel in _LocalizedShortcutLabeler.getShortcutLabel, which already handles Unicode plane 0x00 via JS-safe LogicalKeyboardKey._nonValueBits.
Reproduction on Chrome JS (ddc)

Running flutter test --platform chrome test/menu_anchor_test.dart with MenuItemButton(shortcut: const SingleActivator(LogicalKeyboardKey.tab, control: true), ...) fails on @ 2ef3d18398:

The following TestFailure was thrown running a test:
Expected: exactly one matching candidate
  Actual: _TextWidgetFinder:<Found 0 widgets with text "Ctrl+Tab": []>

Activity

  1. added
    p: material_uimaterial_ui package in flutter/packages
    platform-webWeb applications specifically
    packageflutter/packages repository. See also p: labels.
    on Oct 21, 2026
  2. added
    in triagePresently being triaged by the triage team
    team-designOwned by Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Oct 22, 2026
  3. added a commit that references this issue on Oct 27, 2026
    d155a33
  4. github-actions commented on Nov 10, 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.

  5. locked as resolved and limited conversation to collaborators on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.platform-webWeb applications specificallyteam-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions