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

Improvement on element focus when swapped, set css transitions to 0s. #2679

Open
elabx opened this issue Jun 26, 2024 · 0 comments
Open

Improvement on element focus when swapped, set css transitions to 0s. #2679

elabx opened this issue Jun 26, 2024 · 0 comments

Comments

@elabx
Copy link

elabx commented Jun 26, 2024

As per the focus improvement discussed here: #75 I think another improvement would be to set the transition duration to 0s on the element to be focused, this way it seems you can avoid any visual flickering if you have transitions on focus of elements, which i think is relatively common on input elements too.

I tried adding right before the focus:

newActive.style.transitionDuration = "0s";
newActiveElt.focus(focusOptions)

And this small change seems to help with the swapping transitions. Although I don't understand the reason as to why after swapped in, the transition style gets cleared. Nonetheless, this is actually what I would expect too!

Not sure if there would be a scenario where you would not want to set the state of the focused element to reflect the :focus state?

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

1 participant