Skip to content

Add keyboard support for RangeSlider - #181525

Draft
xxxOVALxxx wants to merge 5 commits into
flutter:masterfrom
xxxOVALxxx:keyboard_support_for_range_slider
Draft

xxxOVALxxx wants to merge 5 commits into
flutter:masterfrom
xxxOVALxxx:keyboard_support_for_range_slider

Conversation

@xxxOVALxxx

@xxxOVALxxx xxxOVALxxx commented Jan 27, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds keyboard support for RangeSlider and new tests. I took this implementation from Slider

This PR fixes the following issue: #179638

Pre-launch Checklist

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

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Jan 27, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request adds keyboard support to the RangeSlider widget, a feature that was previously missing. The changes include handling keyboard inputs to adjust the slider's start and end thumbs, with support for both LTR and RTL text directions. New tests have been added to verify this functionality. My review focuses on improving code structure and readability. I've suggested a refactoring to reduce code duplication in the widget's build method.

Comment thread packages/flutter/lib/src/material/range_slider.dart
@xxxOVALxxx
xxxOVALxxx force-pushed the keyboard_support_for_range_slider branch from 3d086e6 to 7f79f06 Compare January 27, 2026 14:01
@hannah-hyj
hannah-hyj self-requested a review January 28, 2026 00:09
@hannah-hyj hannah-hyj added the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Jan 28, 2026
hannah-hyj
hannah-hyj previously approved these changes Jan 30, 2026

@hannah-hyj hannah-hyj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@hannah-hyj
hannah-hyj requested a review from chunhtai January 30, 2026 21:26
final Map<ShortcutActivator, Intent> shortcutMap = switch (MediaQuery.navigationModeOf(
context,
)) {
NavigationMode.directional => _directionalNavShortcutMap,

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.

reading at the doc and the original issue #54877, the arrow key should be completely ignored in this mode.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Am I correct in understanding that when using the D-pad, Thumbs control should be ignored? What should happen then when using directional mode?

@xxxOVALxxx xxxOVALxxx Jan 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not very familiar with d-pad controls on TVs. Maybe we need this behavior? But how do we change the value then?

Screen.Recording.2026-01-31.at.19.45.16.mov

I suggest that in direction mode, the entire RangeSlider should be the focusable element, and to change values, you need to press Enter to switch to “Edit” mode.

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.

from my experience, if using d pad, a user will need to first hit confirm which will lock them in the control to adjust the value by d pad. It sounds like a non trivial work though. Consider leave a todo here and fix that in a separate pr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the TODO. Thanks for the feedback!

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.

can you also file an issue and link it here?

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.

can you link the issue in the todo as well?

@github-actions github-actions Bot removed the a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) label Feb 5, 2026
@xxxOVALxxx

xxxOVALxxx commented Feb 5, 2026 •

Copy link
Copy Markdown
Contributor Author

I've created issue #181968 to track the NavigationMode.directional behavior that @chunhtai mentioned. This issue will only manifest after this PR is merged

@hannah-hyj
hannah-hyj added this pull request to the merge queue Feb 9, 2026
@hannah-hyj
hannah-hyj removed this pull request from the merge queue due to a manual request Feb 9, 2026
@hannah-hyj
hannah-hyj requested a review from chunhtai February 9, 2026 22:33

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

LGTM, just one minor comment

final Map<ShortcutActivator, Intent> shortcutMap = switch (MediaQuery.navigationModeOf(
context,
)) {
NavigationMode.directional => _directionalNavShortcutMap,

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.

can you link the issue in the todo as well?

@dkwingsmt dkwingsmt added CICD Run CI/CD and removed CICD Run CI/CD labels Mar 25, 2026

@hannah-hyj hannah-hyj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

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

LGTM

@chunhtai chunhtai added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App and removed CICD Run CI/CD labels Apr 6, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 7, 2026
@auto-submit

auto-submit Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/181525, because - The status or check suite Mac_arm64 tool_tests_commands has failed. Please fix the issues identified (or deflake) before re-applying this label.

  • The status or check suite Mac_x64 tool_tests_commands has failed. Please fix the issues identified (or deflake) before re-applying this label.

@dkwingsmt

dkwingsmt commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for your contribution! This PR has reached completion, however we're not able to merge this PR for the moment due to the Material/Cupertino code freeze (#184093). As soon as the decoupling is complete, we will post a way to port this PR to the new packages to land. In the meantime, I'll convert this PR to a draft and apply a label so that we can quickly find it when the freeze is lifted.

@dkwingsmt
dkwingsmt force-pushed the keyboard_support_for_range_slider branch from ce2b9f8 to bf81252 Compare April 8, 2026 18:33
@github-actions github-actions Bot removed the CICD Run CI/CD label Apr 8, 2026
@dkwingsmt

Copy link
Copy Markdown
Contributor

Also I've rebased this PR because the check failure appear to be the result of the recent CICD hiccups.

@dkwingsmt dkwingsmt added the CICD Run CI/CD label Apr 8, 2026

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

Approving to trigger Google tests

@dkwingsmt dkwingsmt added the waiting for code freeze This PR is waiting for a code freeze to resolve. label Apr 8, 2026
@dkwingsmt
dkwingsmt marked this pull request as draft April 15, 2026 18:13
@meredithslota

Copy link
Copy Markdown

Hello! Just checking on the timeline here — this is the likely root cause of a GAR bug on our side (b/496500215) and the earlier code freeze is now thawed. Can this be reviewed/submitted?

@Piinks Piinks added the Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. label Jun 24, 2026
@Piinks

Piinks commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

I've marked this PR as not ready to port to flutter/packages yet.
We'll provide instructions to move this change over to material_ui/cupertino_ui once ready to receive PRs. Thank you!

@dkwingsmt

Copy link
Copy Markdown
Contributor

This PR is ready to port to flutter/packages! 🥳
See guidance and instructions in #188444

@dkwingsmt dkwingsmt added Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. and removed Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. labels Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages waiting for code freeze This PR is waiting for a code freeze to resolve.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants