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

Open
2 tasks done
Fireclunge opened this issue Sep 11, 2023 · 4 comments
Open
2 tasks done

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

Fireclunge opened this issue Sep 11, 2023 · 4 comments
Assignees
Labels
bug 🐛 Something doesn't work component: slider This is the name of the generic UI component, not the React module!

Comments

@Fireclunge
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.
@Fireclunge Fireclunge added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 11, 2023
@Fireclunge
Copy link
Author

Fireclunge 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

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, here are some demos from #373

@mj12albert mj12albert self-assigned this May 24, 2024
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!
Projects
None yet
5 participants