Skip to content

Conversation

jardakotesovec
Copy link

@jardakotesovec jardakotesovec commented Apr 10, 2025

Per my testing fixes #3686

Copy link

vercel bot commented Apr 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 3:25pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 10, 2025 3:25pm

@@ -239,15 +240,16 @@ function useRestoreElement(enabled: Ref<boolean>) {

function useRestoreFocus(
{ ownerDocument }: { ownerDocument: Ref<Document | null> },
enabled: Ref<boolean>
enabled: Ref<boolean>,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats happening here is that, if enabled is also calculated from mounted.value, it:

  1. it hits onUnmounted(() => (mounted.value = false))
  2. that caused recalculating of the computed(() => mounted.value && Boolean(props.features & Features.RestoreFocus))
  3. As result inOnmounted the enabled.value was already false and restoration is skipped

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 this pull request may close these issues.

Dialog is not returning focus after updating to vue 3.5
1 participant