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] Thumb is lagging behind #44851

Open
thany opened this issue Dec 24, 2024 · 3 comments
Open

[Slider] Thumb is lagging behind #44851

thany opened this issue Dec 24, 2024 · 3 comments
Assignees
Labels
component: slider This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material performance ready to take Help wanted. Guidance available. There is a high chance the change will be accepted

Comments

@thany
Copy link

thany commented Dec 24, 2024

Steps to reproduce

Steps:

  1. Drag the Slider component around fast enough

Current behavior

The knob lags behind the mouse cursor. In slow-motion it's clearly visible, but I think it's also noticable at normal speed, especially in person.

lag

Expected behavior

No lag, or try reducing the lag.

Context

No response

Your environment

I tested it just here: https://mui.com/material-ui/react-slider/
So whatever the environment is there, I guess. It says MUI 6.3.0 at the top, so that's probably what it is.

I'm using Firefox.

Search keywords: slider lag/lagging

@thany thany added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 24, 2024
@aarongarciah aarongarciah added component: slider This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Dec 24, 2024
@aarongarciah aarongarciah self-assigned this Dec 24, 2024
@aarongarciah
Copy link
Member

Hey @thany, thanks for reporting. I'm only able to reproduce when applying a 20x CPU slowdown using browser devtools. Are you able to reproduce the issue in other browsers like Chrome? Do you have the devtools open when reproducing the issue?

@aarongarciah aarongarciah added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Dec 24, 2024
@aarongarciah aarongarciah changed the title Slider knob is lagging behind [Slider] Thumb is lagging behind Dec 24, 2024
@thany
Copy link
Author

thany commented Dec 31, 2024

I can't test in Chrome right now (on my personal pc that doesn't have it) but I do remember I didn't have the devtools open.

The 20x CPU slowdown does, however, prove the issue exists. It may seem silly, but your CPU might be tremendously fast. The next mum's tablet SoC might not be though 🤐

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Dec 31, 2024
@aarongarciah aarongarciah added this to the Material UI with Base UI milestone Jan 3, 2025
@mj12albert
Copy link
Member

mj12albert commented Jan 6, 2025

I kind of know of this issue, one thing that could help a bit is that the position of the thumb (as it is being dragged) is currently set using CSS left/bottom/right where the value (%) is derived from the slider value after it has already been rounded/clamped: https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Slider/useSlider.ts#L697-L698

It may be a bit smoother if those %s were unrounded. (Trying this in Base UI here mui/base-ui#1219)

That said, I think this lag is impossible to eliminate completely? Even a native MacOS slider could lag a little bit (recording is slowed down 5x):

output.mp4

@mj12albert mj12albert removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 6, 2025
@aarongarciah aarongarciah removed this from the Material UI with Base UI milestone Jan 6, 2025
@aarongarciah aarongarciah added the ready to take Help wanted. Guidance available. There is a high chance the change will be accepted label Jan 6, 2025
@aarongarciah aarongarciah added this to the Material UI with Base UI milestone Jan 6, 2025
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! package: material-ui Specific to @mui/material performance ready to take Help wanted. Guidance available. There is a high chance the change will be accepted
Projects
None yet
Development

No branches or pull requests

3 participants