Skip to content

Migrate LogicalKeySet to SingleActivator - #80756

Merged
dkwingsmt merged 8 commits into
flutter:masterfrom
dkwingsmt:migrate-single-shortcuts
Apr 26, 2021
Merged

dkwingsmt merged 8 commits into
flutter:masterfrom
dkwingsmt:migrate-single-shortcuts

Conversation

@dkwingsmt

@dkwingsmt dkwingsmt commented Apr 19, 2021 •

Copy link
Copy Markdown
Contributor

This PR follows #78522, which introduced SingleActivator and ShortcutActivator, and applies the change to existing code, by replacing all occurrences of LogicalKeySet to SingleActivator or ShortcutActivator.

This is part of the general keyboard project as in #44918, and resolves the shortcut problems described in #78522 in existing components.

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 feature I am adding, or Hixie said the PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard Bot added a: tests "flutter test", flutter_test, or one of our tests p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Apr 19, 2021
@google-cla google-cla Bot added the cla: yes label Apr 19, 2021
@dkwingsmt
dkwingsmt requested a review from gspencergoog April 23, 2021 02:48

@gspencergoog gspencergoog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

You might change the PR title to say "LogicalKeySet" instead of "LogicalActionSet"...

@dkwingsmt dkwingsmt changed the title Migrate LogicalActionSet to SingleActivator Migrate LogicalKeySet to SingleActivator Apr 23, 2021
@dkwingsmt
dkwingsmt merged commit b8833af into flutter:master Apr 26, 2021
@dkwingsmt
dkwingsmt deleted the migrate-single-shortcuts branch April 26, 2021 21:54
@tvolkert

Copy link
Copy Markdown
Contributor

Even though this didn't break any customer tests, you should probably write a migration guide and list this as a breaking change.

The fact that several tests needed to be updated is an indication that this is likely to affect apps that use shortcuts. It did mine 🙂

tvolkert added a commit to zanderso/chicago that referenced this pull request Apr 30, 2021
@dkwingsmt dkwingsmt added the a: text input Entering text in a text field or keyboard related problems label Jul 29, 2021
@tvolkert tvolkert added the c: API break Backwards-incompatible API changes label Aug 1, 2021
@tvolkert

tvolkert commented Aug 1, 2021

Copy link
Copy Markdown
Contributor

@dkwingsmt did you write a migration guide for this?

@dkwingsmt

Copy link
Copy Markdown
Contributor Author

@tvolkert I'll do it next week. Thanks for reminder.

@dkwingsmt

Copy link
Copy Markdown
Contributor Author

@tvolkert Sorry to have responded so late. I've tried the tests that got changed in this PR, but all of them still compile. What breakage did you encounter? The only thing I can think of is if you wanted to trigger a system shortcut in a deprecated fashion (e.g. trigger Ctrl-C by pressing KeyC first then Control, or by holding Control and Shift then Key C). Just want to confirm if there are breakages I missed.

@tvolkert

Copy link
Copy Markdown
Contributor

Here's my code that needed updating:

final Iterable<LogicalKeyboardKey> activateKeys = WidgetsApp.defaultShortcuts.entries
  .where((MapEntry<LogicalKeySet, Intent> entry) => entry.value is ActivateIntent)
  .map<LogicalKeySet>((MapEntry<LogicalKeySet, Intent> entry) => entry.key)
  .where((LogicalKeySet keySet) => keySet.keys.length == 1)
  .map<LogicalKeyboardKey>((LogicalKeySet keySet) => keySet.keys.single);

Again, since no client tests broke, this isn't technically a breaking change according to our policy, but since we had to update so many tests in this PR, it seemed like a good indication that clients may also have to be updated, in which case I think a migration guide may help them.

@Piinks

Piinks commented Sep 7, 2021

Copy link
Copy Markdown
Contributor

@dkwingsmt was a migration guide made for this?

@dkwingsmt

Copy link
Copy Markdown
Contributor Author

No I didn't. Was about to make but was stalled by the flutter/website rework. Will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: tests "flutter test", flutter_test, or one of our tests a: text input Entering text in a text field or keyboard related problems c: API break Backwards-incompatible API changes c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels. p: cupertino_ui cupertino_ui package in flutter/packages p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants