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] track="inverted" does not work #48

Closed
2 tasks done
aimz-yeah opened this issue Sep 11, 2023 · 6 comments
Closed
2 tasks done

[Slider] track="inverted" does not work #48

aimz-yeah opened this issue Sep 11, 2023 · 6 comments
Assignees
Labels
bug 🐛 Something doesn't work component: slider This is the name of the generic UI component, not the React module! package: @mui/base (legacy)

Comments

@aimz-yeah
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:
https://codesandbox.io/s/practical-knuth-qgjfw9?file=/Demo.js

Steps:

  1. add track="inverted" to

Current behavior 😯

track="inverted" does nothing. It is the same behavior as the default "normal"

Expected behavior 🤔

The slidebar track should come in from the right as opposed to the left

Context 🔦

I'm trying to get the track to come in from the right

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@aimz-yeah aimz-yeah added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 11, 2023
@aimz-yeah
Copy link
Author

aimz-yeah commented Sep 11, 2023

Temporary workaround of mine for anyone curious (i'm using the vertical variant here)

const [valuePercentage, setValuePercentage] = React.useState<number>(50);

<Slider
  ...
  slotProps={{
    track: {
      className: "...",
      style: { height: `${100 - valuePercentage}%`, top: `0` },
    },
  }}
/>

@ZeeshanTamboli ZeeshanTamboli changed the title [base-ui] [slider] track="inverted" does not work in <Slider/> [Slider][base-ui] track="inverted" does not work Sep 23, 2023
@ZeeshanTamboli ZeeshanTamboli removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 23, 2023
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Sep 23, 2023

@Fireclunge Thank you for reporting this bug. Currently, when the track is inverted, the marksActive class is correctly applied to the marks from the last step, but the trackInverted class, which can be used for styling, is not applied to the inverted track. We should also provide documentation on how to address this.

In the meantime, you can use the workaround demonstrated in the CodeSandbox example: https://codesandbox.io/s/green-grass-dv5q33?file=/Demo.js. This workaround applies the background-color to the track based on the track prop value ( checking track === 'inverted' in styled) and adjusts the background-color of the rail.

@olibo733
Copy link

Hi, Can I work on this issue? :)

olibo733 referenced this issue in olibo733/material-ui Nov 7, 2023
olibo733 referenced this issue in olibo733/material-ui Nov 29, 2023
olibo733 referenced this issue in olibo733/material-ui Dec 13, 2023
@michaldudak michaldudak transferred this issue from mui/material-ui Feb 27, 2024
@michaldudak michaldudak changed the title [Slider][base-ui] track="inverted" does not work [Slider] track="inverted" does not work Feb 27, 2024
@michaldudak michaldudak added component: slider This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work labels Feb 27, 2024
@mj12albert
Copy link
Member

mj12albert commented May 24, 2024

In the new API, the current Track component that represents the "fill bar" of the slider will be deprecated. The name "Track" (<Slider.Track />) will be used to refer to the full width of the slider, or the full "touchable" area to be more precise.

The marks prop and Mark/MarkLabel components will also be dropped.

For now, the new API will provide a useSliderContext hook that can be used to implement these (sub)components

@mj12albert
Copy link
Member

UPDATE: Hooks and contexts will not be in the public API (at least for now)

Expected behavior
The slidebar track should come in from the right as opposed to the left

To achieve this, either make the slider RTL, or style the track and indicator to make it appear "inverted"

Copy link

github-actions bot commented Dec 4, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@Fireclunge How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: slider This is the name of the generic UI component, not the React module! package: @mui/base (legacy)
Projects
None yet
5 participants