react-component / react-component/slider

Custom Handlers will cause crashes without .clickFocus

Open
#471 3 comments 14 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

When clicking on the marks to move the handle, the slider will crash with the following error if you're using a custom handle.

Uncaught TypeError: _this.handlesRefs[_this.prevMovedHandleIndex].clickFocus is not a function
    at ComponentEnhancer._this.onMouseUp (createSlider.js:159)

The workaround is to add a clickFocus class function on your custom handle. Not the end of the world but this is still a slight nuance as it cancels out the new way the library handles focus. Perhaps there is a better workaround. This should only effect version 8.6.2 since previous versions handle focus differently.

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 at createSlider.js line 159, in the onMouseUp path that calls clickFocus on the previously moved custom handle. Check how custom handles are represented and preserve focus behavior without requiring the workaround; done means clicking marks with a custom handle no longer crashes in version 8.6.2.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.