Skip to content

Add focus support for CupertinoActionSheetAction #166398#167119

Merged
auto-submit[bot] merged 44 commits into
flutter:masterfrom
O-Hannonen:166398-add-keyboard-focus-support-for-cupertino-action-sheet-action
Nov 12, 2025
Merged

Add focus support for CupertinoActionSheetAction #166398#167119
auto-submit[bot] merged 44 commits into
flutter:masterfrom
O-Hannonen:166398-add-keyboard-focus-support-for-cupertino-action-sheet-action

Conversation

@O-Hannonen

Copy link
Copy Markdown
Contributor

This PR fixes #166398

  • Adds focus support for CupertinoActionSheetAction. This makes it work with keyboard shortcuts
  • Creates new widget, CupertinoTraversalGroup that applies a Cupertino style focus border around its child when any of its descendant has focus
  • Employs CupertinoTraversalGroup in CupertinoActionSheet

How the new implementation looks and behaves:
https://github.com/user-attachments/assets/ea6789f1-921d-4598-bcca-489dc063ff73

How the native counterpart looks and behaves:
https://github.com/user-attachments/assets/4c6ae2a0-7205-4de2-b981-ec7f4839da6e

Pre-launch Checklist

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository f: focus Focus traversal, gaining or losing focus labels Apr 14, 2025
Comment thread packages/flutter/lib/src/cupertino/dialog.dart Outdated
@dkwingsmt dkwingsmt self-requested a review April 23, 2025 18:10
@dkwingsmt

Copy link
Copy Markdown
Contributor

It'll take me some time to review but first I want to say that this is a fascinating change!

@dkwingsmt dkwingsmt 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.

A first round of comments.

Comment thread packages/flutter/lib/src/cupertino/dialog.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/dialog.dart
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/dialog.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/widgets/focus_traversal.dart Outdated
@dkwingsmt

Copy link
Copy Markdown
Contributor

Gave another round of review. My apology that the review was a bit delayed due to the chaos around the US holiday lately.

@O-Hannonen O-Hannonen requested a review from dkwingsmt June 11, 2025 08:18
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/widgets/focus_traversal.dart Outdated
@dkwingsmt

Copy link
Copy Markdown
Contributor

@/chunhtai is OOO until the end of the month, so we'll probably have to wait for him for further progress. Meanwhile I'll see if there's anything I can do.

@dkwingsmt dkwingsmt requested a review from justinmc July 16, 2025 18:12

@justinmc justinmc 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.

Some thoughts here. Thanks for jumping in here and adding focus support, I'm surprised more people haven't noticed this problem.

FYI there are conflicts on this PR that need to be fixed.

Comment thread packages/flutter/lib/src/cupertino/dialog.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/test/cupertino/dialog_test.dart Outdated
Comment thread packages/flutter/test/cupertino/dialog_test.dart Outdated
Comment thread packages/flutter/test/cupertino/dialog_test.dart Outdated
Comment thread packages/flutter/test/cupertino/dialog_test.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
Comment thread packages/flutter/lib/src/cupertino/focus_traversal.dart Outdated
@dkwingsmt

Copy link
Copy Markdown
Contributor

Hi! @O-Hannonen Are you able to address the comments above so we can work together to get this landed? This is a great addition and I'm looking forward to it!

@O-Hannonen O-Hannonen force-pushed the 166398-add-keyboard-focus-support-for-cupertino-action-sheet-action branch from ded01ef to 350cf22 Compare August 7, 2025 10:21
@O-Hannonen

Copy link
Copy Markdown
Contributor Author

Sorry for the delay due to holidays. @dkwingsmt fixed the other issues but the one regarding the constructors, as there were conflicting requests from reviewers.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 16, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 17, 2025
IvoneDjaja pushed a commit to IvoneDjaja/flutter that referenced this pull request Nov 22, 2025
…ter#167119)

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

### This PR fixes flutter#166398
- Adds focus support for `CupertinoActionSheetAction`. This makes it
work with keyboard shortcuts
- Creates new widget, `CupertinoTraversalGroup` that applies a Cupertino
style focus border around its child when any of its descendant has focus
- Employs `CupertinoTraversalGroup` in `CupertinoActionSheet`

How the new implementation looks and behaves:

https://github.com/user-attachments/assets/ea6789f1-921d-4598-bcca-489dc063ff73

How the native counterpart looks and behaves:

https://github.com/user-attachments/assets/4c6ae2a0-7205-4de2-b981-ec7f4839da6e

## Pre-launch Checklist

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
mboetger pushed a commit to mboetger/flutter that referenced this pull request Dec 2, 2025
…ter#167119)

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

### This PR fixes flutter#166398
- Adds focus support for `CupertinoActionSheetAction`. This makes it
work with keyboard shortcuts
- Creates new widget, `CupertinoTraversalGroup` that applies a Cupertino
style focus border around its child when any of its descendant has focus
- Employs `CupertinoTraversalGroup` in `CupertinoActionSheet`

How the new implementation looks and behaves:

https://github.com/user-attachments/assets/ea6789f1-921d-4598-bcca-489dc063ff73

How the native counterpart looks and behaves:

https://github.com/user-attachments/assets/4c6ae2a0-7205-4de2-b981-ec7f4839da6e

## Pre-launch Checklist

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
…ter#167119)

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

### This PR fixes flutter#166398
- Adds focus support for `CupertinoActionSheetAction`. This makes it
work with keyboard shortcuts
- Creates new widget, `CupertinoTraversalGroup` that applies a Cupertino
style focus border around its child when any of its descendant has focus
- Employs `CupertinoTraversalGroup` in `CupertinoActionSheet`

How the new implementation looks and behaves:

https://github.com/user-attachments/assets/ea6789f1-921d-4598-bcca-489dc063ff73

How the native counterpart looks and behaves:

https://github.com/user-attachments/assets/4c6ae2a0-7205-4de2-b981-ec7f4839da6e

## Pre-launch Checklist

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: cupertino flutter/packages/flutter/cupertino repository f: focus Focus traversal, gaining or losing focus framework flutter/packages/flutter repository. See also f: labels. will affect goldens Changes to golden files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CupertinoActionSheetAction: Add keyboard support (Ipad, IOS)

4 participants