react-component / react-component/slider

Error while dragging: Cannot read property 'toFixed' of undefined

Open
#387 11 comments 6 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

Happens with the latest version of rc-slider, also in the last version of ant-design.
Happens when dragging horizontal slider and keep dragging while getting out of the slider X and Y range.

In this line (createSlider.js):
var nextValue = this.trimAlignValue(this.calcValue(pixelOffset));

pixelOffset is negative, and this.calcValue(pixelOffet) returns NaN.

Uncaught TypeError: Cannot read property 'toFixed' of undefined
    at Object.ensureValuePrecision (utils.js:97)
    at ComponentEnhancer.trimAlignValue (Slider.js:170)
    at ComponentEnhancer.calcValueByPos (createSlider.js:260)
    at ComponentEnhancer.onMove (Slider.js:132)
    at ComponentEnhancer._this.onMouseMove (createSlider.js:153)

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

Reproduce the failure by dragging a horizontal slider beyond its X and Y range, then trace the reported path through createSlider.js, Slider.js, and utils.js, starting at calcValue and ensureValuePrecision. Done means the out-of-range drag no longer raises the toFixed error and the slider continues handling the gesture safely.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.