react-component / react-component/slider

Slider going off screen after updating values

Open
#479 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.1k
Forks
768
Avg merge
11d 22h
Merged PRs (30d)
5

Description

I've come across an issue with the slider component that appeared since version 8.6.3 (before this it worked fine). When rendering the slider with certain min / max values, and then updating these values and causing a re-render, the width gets set to more then 100% and it grows out of it's original place.

To demonstrate this I've created two examples in sandbox, one where we have a initial min value that is max int and a max value that is zero (which we used to do), which is replaced after two seconds with the correct values. You see that initially it starts out at 100% of the parent and after 2 seconds the max goes completely off the screen on the right. https://codesandbox.io/s/721968oqv6

The other example I have is a more realistic one, where initially the min and max are set to 0 and 100 until the actual values are known. This again is simulated by a delay of 2 seconds. You see that it initially starts out at 100% again, and after 2 seconds it goes off the screen on the left side. https://codesandbox.io/s/2z4jv5zozj

For now we will stay on 8.6.1, where this does work correctly, but this should be fixed. Maybe that slider width should be statically set to 100%?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the slider component behavior in the two linked CodeSandbox examples, comparing version 8.6.3 with 8.6.1. Trace how the component recalculates its width when min and max values change during a re-render; done means the slider remains within its parent after the delayed values are applied.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.