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

Focus is lost when showSelectionBarFromValue-option changes #411

Closed
dagerikhl opened this issue Sep 11, 2016 · 5 comments
Closed

Focus is lost when showSelectionBarFromValue-option changes #411

dagerikhl opened this issue Sep 11, 2016 · 5 comments

Comments

@dagerikhl
Copy link

Steps to reproduce

  1. Make a slider with a set showSelectionBarFromValue.
  2. Add a line that changes that attribute in a watcher which watches the value of the slider.
  3. Focus the slider and use the keyboard to manipulate the slider.

Expected behaviour

Changing the showSelectionBarFromValue (or any other options this might be a problem for) should not cause loss of focus for the slider.

Actual behaviour

The watcher triggers and focus is lost from the slider when the showSelectionBarFromValue is changed. One has to focus something else and the refocus the slider to regain focus. But changing it again causes loss of focus.

@ValentinH
Copy link
Member

Could you please provide a demo showing the issue? However, if it is what I think, then it's "normal": when an option is changed, the slider is fully re-rendered and thus the focus is lost...

@ValentinH
Copy link
Member

Closing as there was no answers for 10 days.

@dagerikhl
Copy link
Author

dagerikhl commented Sep 22, 2016

Ah, sorry! I had completely forgot about this issue, my bad!
I tried creating a demo, but I unfortunately was not able to reproduce a functioning Listener in your demo Fiddle.
Your explanation sounds likely, and seems to explain the issue I'm experiencing. I understand that this might be normal behaviour, but is it necessary for the options to work? I would think allowing people to update options without losing focus would be a nice feature, as a developer (such as myself) might want to show some dynamic data, like for an example a point on the range, that at times change.
I'll give creating a demo one more try, and edit here if I get it working.

EDIT: I've got the demo to work, to illustrate the problem: http://jsfiddle.net/tr8z52mw/1/

@ValentinH
Copy link
Member

Yes I totally understand your issue. However, I think that for now redrawing the slider when an option change is the safest/easiest way to handle that.

For your specific issue, a specific behavior could be added to refocus the correct element after a rerender if one was focused before. Do you want to provide a pull request for it, I can help and guide you if you want?

@ValentinH
Copy link
Member

Even if I'm not really active anymore on this project, I'm still enthusiast so I already wrote a solution... 😄 I could reproduce your issue but not exactly like you described: after rerender, the element is still focus but can't be moved with the slider... Where you totally losing the focus? If yes, on which browser?

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

No branches or pull requests

2 participants