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

Version 8.6.3 is a breaking version #485

Open
yanmaoyuan opened this issue Oct 17, 2018 · 1 comment
Open

Version 8.6.3 is a breaking version #485

yanmaoyuan opened this issue Oct 17, 2018 · 1 comment

Comments

@yanmaoyuan
Copy link

We use rc-slider within a popup. The popup listens to onBlur to close. This is causing the popup to close while we are moving the slider.

onEnd = () => { this.setState({ handle: null, }, this.blur); this.removeDocumentEvents(); this.removeDocumentEvents(); this.props.onAfterChange(this.getValue()); this.props.onAfterChange(this.getValue()); } }

@rakelley
Copy link

This is the set of changes from #371 , introduced in 8.5.0. I've spent some time going in circles on a fix and haven't found one that universally works yet.

There are two fundamental problems:

  • Clicking a handle focuses the handle, but the focus does not bubble, so any parent container thinks the slider is no longer focused. This is easily fixable by removing utils.pauseEvent(e) from createSlider.onFocus.
  • Releasing a handle blurs everything and focuses nothing, so any parent container treats the slider as no longer focused. This has no easy solution.

The Range.onEnd -> createSlider.blur chain is the culprit, as it's called both when a handle is released and when the slider is blurred, and blurs all handles.

  • Not blurring all handles leads to handles becoming "sticky", after dragging a handle you have to click a new handle once to focus it before you can drag the new handle.
  • Focusing the slider after blurring all handles causes actual instances of the slider becoming unfocused to be ignored, as the same function chain is triggered by createSlider.onBlur, which will of course be triggered if you click on some other page element with the slider focused.
  • Blurring handles but stopping the propagation of the blur event prevents sticky handles, but it's impossible to distinguish between "handle was manually blurred" and "handle was blurred by user clicking somewhere else", so again the slider itself becomes functionally sticky.

Maybe someone with more familiarity with the code base has some idea, in the mean time 8.4.1 works fine for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants