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

useActiveElement is not updated to null when activeElement is removed in Firefox & Safari #3954

Open
7 tasks done
lazzzis opened this issue May 5, 2024 · 0 comments · May be fixed by #3958
Open
7 tasks done

useActiveElement is not updated to null when activeElement is removed in Firefox & Safari #3954

lazzzis opened this issue May 5, 2024 · 0 comments · May be fixed by #3958

Comments

@lazzzis
Copy link

lazzzis commented May 5, 2024

Describe the bug

This is only reproducible on Firefox and Safari.

If the activeElement is removed, the useActiveElement won't update the result to null. See video recorded on Firefox.

Screen.Recording.2024-05-04.at.8.43.33.PM.mov

Currently, the useActiveElement is using blur event to track whether an element is unfocused. But per MDN doc:

Note however that blur is not fired when a focused element is removed from the document.

The blur is not fired when the activeElement is removed. This is discussed in Mozilla's bug tracker https://bugzilla.mozilla.org/show_bug.cgi?id=559561

One common use is the dialog. When the dialog is removed, the useActiveElement does not update the value accordingly.

Reproduction

https://stackblitz.com/edit/vitejs-vite-kmuiik?file=src%2FApp.vue

System Info

System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 125.17 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
    pnpm: 8.15.3 - ~/Documents/Projects/JavaScript/VueJs/vueuse/node_modules/.bin/pnpm
  Browsers:
    Chrome: 124.0.6367.119
    Chrome Canary: 126.0.6459.0
    Safari: 17.4.1
  npmPackages:
    @vueuse/core: workspace:* => 10.9.0 
    @vueuse/integrations: workspace:* => 10.9.0 
    @vueuse/math: workspace:* => 10.9.0 
    @vueuse/rxjs: workspace:* => 10.9.0 
    @vueuse/shared: workspace:* => 10.9.0 
    vue: ^3.4.19 => 3.4.19

Used Package Manager

pnpm

Validations

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

Successfully merging a pull request may close this issue.

1 participant