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

Always applies focus-visible to inputs in React even when click #251

Open
sklawren opened this issue Mar 31, 2021 · 3 comments
Open

Always applies focus-visible to inputs in React even when click #251

sklawren opened this issue Mar 31, 2021 · 3 comments

Comments

@sklawren
Copy link

sklawren commented Mar 31, 2021

This script gets confused in React with inputs. When you click on them, it adds the various focus-visible settings as if you used the keyboard to select them.

This does not happen with other elements like select, button, etc.

@timgoeller
Copy link

Seems to be the case in Vue.js aswell (so maybe it's not framework-related).

@Justineo
Copy link
Contributor

I believe it's intentional and not framework-related. Focusing an input indicates that the user should switch their input modality to keyboard.

if (tagName === 'INPUT' && inputTypesAllowlist[type] && !el.readOnly) {
return true;
}
if (tagName === 'TEXTAREA' && !el.readOnly) {
return true;
}
if (el.isContentEditable) {
return true;
}

@timgoeller
Copy link

timgoeller commented Apr 27, 2021

@Justineo Ah, that makes sense! The spec also suggests that (basically) anything that you can type in should indicate focus (though the decision is ultimately made by the User-Agent). 👍

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

3 participants