Closed craigkovatch closed 5 years ago
Hi @craigkovatch,
The idea at the heart of that statement is that everyone who uses a mouse will most likely have to switch to using the keyboard to fill in a form (this generally doesn't go the other way, where a keyboard user would switch to using their mouse). One of the popular uses of What Input is to style better, more visible, focus indicators for keyboard users. So it would be jarring for a mouse user to suddenly get keyboard focus styles when working with a form. To help with this, What Input provides two outputs in the form of data attributes: data-whatinput
and data-whatintent
.
data-whatinput
reacts only to "physical" interactions with the page (i.e. mousedown
, keydown
, and touchstart
).
data-whatintent
makes a couple of assumptions. It uses mousemove
to predict that someone is using the mouse before a "physical" interaction takes place. It also assumes that if someone was using the mouse right before they started interacting with form inputs (except the <button>
since it can be used outside of forms), their primary input is a mouse and that should be retained, even when they're typing.
I created a demo page where you can play around with switching input styles to see how the script reacts.
I hope that helps! I'm happy to answer more questions and thanks for checking out my script!
What about when right-clicking to paste into an ?