preact-mdl icon indicating copy to clipboard operation
preact-mdl copied to clipboard

Slider loses focus on change

Open unindented opened this issue 9 years ago • 4 comments
trafficstars

Example without MDL: http://jsfiddle.net/fsebyLz2/ Example with MDL: http://jsfiddle.net/stx4n4y8/

Use your keyboard to focus on the slider. With MDL, the slider loses focus on every change.

I can't figure out what could be causing this...

unindented avatar Feb 19 '16 10:02 unindented

Related to https://github.com/developit/preact/issues/54? Although I can only repro the problem on Chrome and Safari, but not Firefox...

unindented avatar Feb 19 '16 10:02 unindented

I think this has something to do with component recycling. Working on a revamp of that right now.

developit avatar Feb 19 '16 11:02 developit

@unindented Alright, it looks like this is because of another one of MDL's lovely "wrapper" divs. When we're upgrading the input element to an MDL slider, they actually rip it out of the DOM and inject a div around it, which is going to get overwritten every time preact tries to reconcile the VTree against the DOM. This can be fixed by creating the wrapper div in preact-mdl's Slider component. Might be a bit before I can PR a fix.

developit avatar Feb 19 '16 14:02 developit

hate to dredge up an old thread, but this will be fixed here in order to fix compatibility with preact@beta, which no longer removes unknown elements by default.

developit avatar Nov 27 '16 14:11 developit