Repository navigation
MenuItemButton shortcut labels do not follow the Apple HIG on Mac and iOS #129308
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
The Apple Human Interface Guidelines give a specific ordering of the symbols used as modifier keys in menu shortcuts. These guidelines are encoded into the native Cocoa or UIKit menu classes, and are intended to ensure that symbols are always aligned into columns of like symbols. This ordering is, from left to right: ⌃, ⎇, ⇧, ⌘.
Currently, MenuItemButton uses a different ordering across all platforms, including Mac and iOS: ⎇, ⌃, ⌘, ⇧. This violates the HIG, particularly since a shortcut like ⌘⇧S (which should be ⇧⌘S) does not align vertically with a shortcut like ⌘S. Native menus also allocate a fixed amount of space for the shortcut trigger so that the shortcuts align perfectly, which MenuItemButton does not.
Expected results
Code like this:
MenuItemButton(
shortcut: SingleActivator(
LogicalKeyboardKey.keyS,
control: true,
meta: true,
shift: true,
alt: true,
),
child: Text('Reticulate Splines'),
),Should result in a menu item with a visual appearance, on Mac or iOS, like this:
Reticulate Splines ⌃⎇⇧⌘S
Which conforms to the Apple HIG.
Actual results
Code like this:
MenuItemButton(
shortcut: SingleActivator(
LogicalKeyboardKey.keyS,
control: true,
meta: true,
shift: true,
alt: true,
),
child: Text('Reticulate Splines'),
),Results in a menu item with a visual appearance, on Mac or iOS, like this:
Reticulate Splines ⎇⌃⌘⇧S
which does not conform to the Apple HIG.
Code sample
Code sample
MaterialApp(
home: Material(
child: MenuBar(
children: <Widget>[
SubmenuButton(
menuChildren: <Widget>[
MenuItemButton(
shortcut: SingleActivator(
LogicalKeyboardKey.keyS,
control: true,
meta: true,
shift: true,
alt: true,
),
child: Text('Reticulate Splines'),
),
],
child: Text('File'),
),
],
),
),
),Screenshots or Video
No response
Logs
No response
Flutter Doctor output
N/A
Activity
huycozy commentedon Jun 22, 2023
Thank you for filing this. Reproduced the issue on the latest Flutter channels.
Adding HIG references here and expected sample on macOS native:
flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.0.1 22A400 darwin-x64, locale en-VN) • Flutter version 3.10.5 on channel stable at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 796c8ef792 (29 hours ago), 2023-06-13 15:51:02 -0700 • Engine revision 45f6e00911 • Dart version 3.0.5 • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-33, build-tools 32.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.79.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.66.0 [✓] Connected device (5 available) • Pixel 3a (mobile) • 964AY0WL20 • android-arm64 • Android 12 (API 32) • iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios • iOS 15.7.2 19H218 • iPhone 14 Pro (mobile) • 98082851-A0C4-4E39-A310-21C48B10A364 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.133 [✓] Network resources • All expected network resources are available. • No issues found!5 remaining items
flutter-triage-bot commentedon Jul 10, 2023
The
triaged-ioslabel is irrelevant if there is noteam-ioslabel orfyi-ioslabel.Reorders menu item button shortcuts on Mac-like platforms (#129309)
Reorders menu item button shortcuts on Mac-like platforms (flutter#12…
github-actions commentedon Aug 9, 2023
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 -vand a minimal reproduction of the issue.