Skip to content

Add focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons.#43213

Merged
gspencergoog merged 7 commits intoflutter:masterfrom
gspencergoog:switch_focus
Oct 23, 2019
Merged

Add focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons.#43213
gspencergoog merged 7 commits intoflutter:masterfrom
gspencergoog:switch_focus

Conversation

@gspencergoog
Copy link
Contributor

Description

In order to enable keyboard navigation to more controls, I've added focus nodes to switches, checkboxes, and radio buttons. In addition, this change enables mouse hover over these controls.

Tests

  • Added tests for focus, hover, and shortcut activation for Checkbox, Radio, and Switch.

Breaking Change

  • No, this is not a breaking change.

@fluttergithubbot fluttergithubbot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Oct 21, 2019
@gspencergoog gspencergoog force-pushed the switch_focus branch 2 times, most recently from c5ef3d7 to efde5ba Compare October 21, 2019 22:18
Copy link
Contributor

@darrenaustin darrenaustin left a comment

Choose a reason for hiding this comment

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

Other than a few minor comments and the tristate issue with checkbox, this LGTM.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we currently using kIsWeb as a marker for desktop?

Also, is a single line if clause the preferred style for this in these conditional data structures? I kinda like it, but it does seem different than the if statement counterpart.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I'm using it for a marker for web :-)

Web only interacts with these kinds of controls using the space bar, not the enter key, so we only do "select", not "activate". Other platforms use either.

Yes, single line is preferred:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#prefer-single-line-for-short-collection-if-and-collection-for

Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed in person, this implementation doesn't appear to match the documentation for tristate on the Checkbox. Also need to look into firing a semantic event here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the documentation to match the implementation, now firing a semantics event.

@gspencergoog gspencergoog force-pushed the switch_focus branch 2 times, most recently from 1ad86ec to afae86d Compare October 22, 2019 01:23
@gspencergoog gspencergoog merged commit 9000672 into flutter:master Oct 23, 2019
jonahwilliams pushed a commit that referenced this pull request Oct 23, 2019
jonahwilliams pushed a commit that referenced this pull request Oct 23, 2019
gspencergoog added a commit to gspencergoog/flutter that referenced this pull request Oct 23, 2019
gspencergoog added a commit that referenced this pull request Oct 28, 2019
…s, and radio buttons. (#43384)

This re-lands the change that adds focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (#43213)

No changes from original, except for finding the right RenderBox in dev/integration_tests/android_semantics_testing/test_driver/main_test.dart.
gspencergoog added a commit that referenced this pull request Oct 30, 2019
…s, and radio buttons. (#43657)

This re-lands the change that adds focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (#43213), with fixes for the web tests that weren't enabled in the master that it was synced to when I first landed it.
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
…dio buttons. (flutter#43213)

In order to enable keyboard navigation to more controls, I've added focus nodes to switches, checkboxes, and radio buttons. In addition, this change enables mouse hover over these controls.

- Added tests for focus, hover, and shortcut activation for Checkbox, Radio, and Switch.
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
…s, and radio buttons. (flutter#43384)

This re-lands the change that adds focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (flutter#43213)

No changes from original, except for finding the right RenderBox in dev/integration_tests/android_semantics_testing/test_driver/main_test.dart.
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
…s, and radio buttons. (flutter#43657)

This re-lands the change that adds focus nodes, hover, and shortcuts to switches, checkboxes, and radio buttons. (flutter#43213), with fixes for the web tests that weren't enabled in the master that it was synced to when I first landed it.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants