Skip to content

Conversation

@markusaksli-nc
Copy link
Contributor

@markusaksli-nc markusaksli-nc commented Feb 15, 2022

Dismiss the EditableText selection controls toolbar by pressing ESC using the DismissIntent. @justinmc since this is a global shortcut in app.dart it should circumvent the concern about not always dismissing the menu?

This does come with side-effects like no longer being able to dismiss something like a DialogueRoute with ESC when it contains a text field that is focused. Maybe that makes more sense if you can unfocus EditableText by pressing ESC as well.

Fixes #98163

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Feb 15, 2022
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

One comment below about iOS/Android with a native keyboard, but I realize that's probably pretty niche.

ReplaceTextIntent: _replaceTextAction,
UpdateSelectionIntent: _updateSelectionAction,
DirectionalFocusIntent: DirectionalFocusAction.forTextField(),
DismissIntent: CallbackAction<DismissIntent>(onInvoke: (_) => hideToolbar(false)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried this on a native iOS app on iPad with a physical keyboard, and pressing escape did nothing. Maybe do a switch statement here and don't hide the toolbar on iOS? And try to figure out what happens on Android if you can.

You can just merge this PR now if you want though since it's otherwise good to go. Maybe open a separate PR to do the switch statement or open an issue for it. Up to you.

@markusaksli-nc
Copy link
Contributor Author

Merging this for now, it seems like it isn't supposed to dismiss the menu on both Android and iOS but for some reason, it already doesn't? Looking into this more tomorrow.

@markusaksli-nc markusaksli-nc added waiting for tree to go green a: text input Entering text in a text field or keyboard related problems and removed a: text input Entering text in a text field or keyboard related problems labels Feb 16, 2022
@fluttergithubbot fluttergithubbot merged commit 9407700 into flutter:master Feb 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Feb 16, 2022
@justinmc
Copy link
Contributor

Sounds good, interesting that the menu isn't dismissed already...

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2022
markusaksli-nc added a commit that referenced this pull request Feb 16, 2022
markusaksli-nc added a commit that referenced this pull request Feb 16, 2022
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The escape key should close the right click menu on desktop

3 participants