bigskysoftware / bigskysoftware/htmx
Improvement on element focus when swapped, set css transitions to 0s.
- Dominant language
- JavaScript
- Stars
- 49.4k
- Forks
- 1.7k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 30
Description
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?
Contributor guide
Assessment
This issue has not been assessed yet.