Skip to content

[Material] Add focus, highlight, and keyboard shortcuts to Slider#53945

Merged
fluttergithubbot merged 23 commits intoflutter:masterfrom
clocksmith:keyboard-slider
Apr 16, 2020
Merged

[Material] Add focus, highlight, and keyboard shortcuts to Slider#53945
fluttergithubbot merged 23 commits intoflutter:masterfrom
clocksmith:keyboard-slider

Conversation

@clocksmith
Copy link
Contributor

Description

  • Make the slider focusable and hoverable.
  • Create keyboard shortcuts to move the slider

Related Issues

closes #48905

Tests

I added the following tests:

slider.dart:

  • focus test
  • hover test
  • keyboard test

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.
    • I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
    • I got input from the developer relations team, specifically from: Replace with the names of who gave advice
    • I wrote a migration guide: Replace with a link to your migration guide

@fluttergithubbot fluttergithubbot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. work in progress; do not review labels Apr 3, 2020
@clocksmith clocksmith marked this pull request as ready for review April 3, 2020 21:44
@clocksmith clocksmith changed the title Make slider focusable and hoverable, need to fix Semantics tests [Material] Add focus, highlight, and keyboard shortcuts to Slider Apr 3, 2020
Copy link
Contributor

@rami-a rami-a left a comment

Choose a reason for hiding this comment

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

LGTM with some questions/comments

@clocksmith clocksmith requested a review from gspencergoog April 6, 2020 18:42
@clocksmith clocksmith requested a review from HansMuller April 7, 2020 15:06
Copy link
Contributor

@rami-a rami-a left a comment

Choose a reason for hiding this comment

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

LGTM

]);
});
}
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the new line got removed

Copy link
Contributor

@gspencergoog gspencergoog left a comment

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

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

@andraskende
Copy link

I am trying to use slider in a video player on Android TV app, testing on Nvidia Shield TV
just upgraded master, with this change i can now use the slider with remote d-pad, but there is an issue:
slider once focused cant unfocus to other buttons on screen...
d-pad left and bottom rewinds, right and top forwards..... should be left: rewind, right forward,
top and bottom moves to other widgets...
here is my code:
https://github.com/andraskende/apptv1/blob/master/lib/videoplayer.dart#L202-L211
Thanks !!

@gspencergoog
Copy link
Contributor

For text fields, we had to add the ignoreTextFields option to the DirectionalFocusIntent to make text fields allow DPAD movement vertically.

Perhaps what we really need is a UI mode that indicates that an app wants to use DPAD navigation instead of normal navigation modes.

@gspencergoog
Copy link
Contributor

Actually, after discussing it with @goderbauer, I think I'm going to try and implement an InheritedWidget that sets the navigation mode for a subtree (much like Directionality does), as he suggested. Then we can use that to determine how to interpret arrow keys differently in cases where the navigation mode is DPAD-based.

@clocksmith
Copy link
Contributor Author

@gspencergoog That sounds like a good idea. Do we have an idea of which components would need to update (and consume this InheritedWidget)?

@andraskende Can you open a separate ticket for adding proper DPAD support for the Slider?

@gspencergoog
Copy link
Contributor

For various different reasons, I think this is the list:

@gmoraja
Copy link

gmoraja commented Apr 21, 2020

@gspencergoog on a mobile device, the slider can be correctly navigated with an external keyboard now, but it doesn't receive focus with TalkBack yet.

@clocksmith clocksmith deleted the keyboard-slider branch June 8, 2020 13:59
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 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.

Slider is not focusable when navigating with a keyboard

9 participants