Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default SmallChange value for WinUI slider #14912

Merged
merged 2 commits into from Jun 29, 2023
Merged

Conversation

rachelkang
Copy link
Member

@rachelkang rachelkang commented May 3, 2023

Description of Change

Use default SmallChange value for WinUI slider.

Context:

Currently, we are calculating a value for SmallChange to be 0.1% at all times. This makes the slider experience pretty inaccessible, via touch/tap (with Narrator, on touch devices, double tap increments and triple tap decrements) and keyboard (using left/right arrow keys, with or without Narrator). This is inaccessible because it requires 1000 strokes to move the thumb from one end of the slider to the other.

On WinUI, the default values make slider increment by just 1 value (which is a different % based on the min and max values; i.e. 100% for default slider 0 to 1; 10% for a slider with min 5 to max 15) via mouse, touch, and keyboard. As long as a StepFrequency or SmallChange is NOT set and/or are the same value, the increment is consistent via both mouse/touch and keyboard. While this would be an ideal condition to have, it will lead to either: (a) touch and keyboard navigation inaccessible, or (b) mouse dragging slider smoothly in-between values impossible (thumb will snap to increment values).

Since we don't currently have a Slider property in .NET MAUI for setting the increment, we need to ensure that the default increment that we offer is still sensible and accessible. In investigating the behavior on other platforms, I discovered that unlike on WinUI, the mouse drag behavior is actually NOT consistent with the touch and keyboard behaviors for slide ron any of the other platforms.

So, at least for now, it makes sense to stick to the default value for SmallChange. (We can keep the 0.001 increment for StepFrequency for now, as that is what allows for the smooth mouse click/drag sliding of the slider).

(no crashing here on the min=max=value edge case either, as that was happening due to the increment calculation previously being based on min and max values)

Issues Fixed

Fixes #14748

@rachelkang rachelkang requested a review from Redth May 3, 2023 21:20
@ghost ghost added the area/controls 🎮 Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 4, 2023
Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

How does this work for decimal values? For example we want a slider from 0 to 1 (the default min/max values), we would want a smooth transition. How do I get a 0.25?

How does this work on Android and iOS? How does the slider handle selecting a 0.25 in a 0 to 1 range? What about when we have a 0 to 5 and you want to select 2.5?

Do we maybe need the small change in our API so we don't have to make this decision?

@rachelkang
Copy link
Member Author

rachelkang commented May 4, 2023

@mattleibow Regarding decimal values and smooth transitions - good point! I was focusing mainly on mouse/touch interaction and keyboard interaction from a screen reader perspective, and somehow missed that WinUI mouse/touch behavior WITHOUT screen reader activation also jumps by the default and doesn't allow for smooth sliding.

I missed this also because none of the other platforms behave like this. Here are my findings on this: #14748 (comment)

I do think introducing an API would be beneficial down the line, but since there are so many inconsistencies between platforms, it would require a lot more investigation. For now, it's important that we ensure the WinUI experience is more accessible.

Based on your feedback, I reintroduced the original code and just removed SmallChange. This retains the smooth mouse click and drag continuous transitions, while making the keyboard (with and without screen reader) and touch (with screen reader) experiences more accessible by using the default increment of WinUI. This seems like the best solution for now! Updated PR description to reflect new findings.

@rachelkang rachelkang changed the title Use default StepFrequency and SmallChange values for WinUI slider Use default SmallChange value for WinUI slider May 4, 2023
@rachelkang rachelkang requested a review from mattleibow May 5, 2023 13:54
@rachelkang rachelkang enabled auto-merge (squash) June 28, 2023 18:01
@rachelkang rachelkang merged commit 70cdef5 into main Jun 29, 2023
29 checks passed
@rachelkang rachelkang deleted the slider-accessibility branch June 29, 2023 07:10
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/controls 🎮 Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor control-slider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evaluate slider increment defaults for consistency and accessibility
4 participants