markusenglund / react-switch

A draggable toggle-switch component for React. Check out the demo at:
https://react-switch.netlify.com/
MIT License
1.33k stars 101 forks source link

HTML order. Input is last. #70

Open igoriok1994 opened 4 years ago

igoriok1994 commented 4 years ago

Hi,

Can you check HTML input's order like that.

image

It will be better, as I could properly use CSS tidle (~) selector to control handle.

Something like that:

input:focus ~ .react-switch-handle {........}
igoriok1994 commented 4 years ago

Or maybe you can make callbacks for onFocus and onBlur events?

igoriok1994 commented 4 years ago

Also, why input ref name is $inputRef for dev env and y for production? How can I access input ref? ReactDOM.findDOMNode is not a good practice.

markusenglund commented 3 years ago

No, I won't make that change. The invisible input element acts in lots of strange ways on different browsers and platforms. Changing the order might very well break something.

I didn't have in mind that someone would try to access the inputRef. As you noticed I've minified it in the production mode to save bytes.

Sorry for not responding earlier.