You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A component focuses an element in the onMounted hook and the focus is lost after the render function.
In the Codesandbox there is a TestButton component that sets the focus in onMounted. In the respective test there are two test cases - one using @testing-library/vue and one using @vue/test-utils directly. The behavior of document.activeElement differs between the two. @testing-library/vue loses the state of document.activeElement
Describe the bug
A component focuses an element in the
onMounted
hook and the focus is lost after the render function.In the Codesandbox there is a TestButton component that sets the focus in
onMounted
. In the respective test there are two test cases - one using@testing-library/vue
and one using@vue/test-utils
directly. The behavior ofdocument.activeElement
differs between the two.@testing-library/vue
loses the state of document.activeElementTo Reproduce Steps to reproduce the behavior:
Codesandbox
Expected behavior
document.activeElement
should be the button that was focused in theonMounted
hookScreenshots
Related information:
@testing-library/vue
version: 8.1.0Vue
version: 3.4.15node
version: v20.12.0npm
(oryarn
) version: npm 10.5.0Relevant code or config (if any)
TestButton.vue
The text was updated successfully, but these errors were encountered: