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

[Slider] Set CSS writing-mode and update vertical slider docs #44537

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mj12albert
Copy link
Member

Closes #44237

@mj12albert mj12albert added the component: slider This is the name of the generic UI component, not the React module! label Nov 25, 2024
@mj12albert mj12albert changed the title [Slider] Sets CSS writing-mode, update docs [Slider] Set CSS writing-mode and update vertical slider docs Nov 25, 2024
@mui-bot
Copy link

mui-bot commented Nov 25, 2024

Netlify deploy preview

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against fe585a2

@mj12albert mj12albert force-pushed the fix/vertical-slider-a11y branch 3 times, most recently from e3164ed to 0c864c7 Compare November 25, 2024 07:48
@mj12albert mj12albert marked this pull request as ready for review November 25, 2024 08:05
Comment on lines +690 to +695
const cssWritingMode = React.useMemo(() => {
if (orientation === 'vertical') {
return isRtl ? 'vertical-rl' : 'vertical-lr';
}
return undefined;
}, [isRtl, orientation]);
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need React.useMemo here? It's handling just an if statement and useMemo itself probably does more computation than this.

If you apply `-webkit-appearance` you could prevent keyboard navigation for horizontal arrow keys for a truly vertical slider.
This might be less confusing to users compared to a change in direction.
```css
.MuiSlider-thumb > input {
Copy link
Member

Choose a reason for hiding this comment

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

Would .MuiSlider-thumb input be a better selector? e.g. if the internal DOM structure changes and input is not a direct child in the future, this would break. And since afaik there can only be one input it's safe to assume that it will always target the input.

**WARNING**: Chrome, Safari and newer Edge versions that is any browser based on WebKit exposes `<Slider orientation="vertical" />` as horizontal ([chromium issue #40736841](https://issues.chromium.org/issues/40736841)).
By applying `-webkit-appearance: slider-vertical;` the slider is exposed as vertical.
:::warning
Chrome versions below 124 implements `aria-orientation` incorrrectly for vertical sliders and exposes them as `'horizontal'` in the accessibility tree. ([Chromium issue #40736841](https://issues.chromium.org/issues/40736841))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Chrome versions below 124 implements `aria-orientation` incorrrectly for vertical sliders and exposes them as `'horizontal'` in the accessibility tree. ([Chromium issue #40736841](https://issues.chromium.org/issues/40736841))
Chrome versions below 124 implements `aria-orientation` incorrectly for vertical sliders and exposes them as `'horizontal'` in the accessibility tree. ([Chromium issue #40736841](https://issues.chromium.org/issues/40736841))

**WARNING**: Chrome, Safari and newer Edge versions that is any browser based on WebKit exposes `<Slider orientation="vertical" />` as horizontal ([chromium issue #40736841](https://issues.chromium.org/issues/40736841)).
By applying `-webkit-appearance: slider-vertical;` the slider is exposed as vertical.
:::warning
Chrome versions below 124 implements `aria-orientation` incorrrectly for vertical sliders and exposes them as `'horizontal'` in the accessibility tree. ([Chromium issue #40736841](https://issues.chromium.org/issues/40736841))
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why we actively support Chrome 109? Why the jump from 109 to 119 in https://github.com/mui/material-ui/blob/v6.1.8/.browserslistrc#L28-L29? I wonder if this warning makes sense now that Chrome is already on v131.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: slider This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs][Slider] Outdated guidance for vertical sliders
3 participants