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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useActiveElement): scheduled update #2581

Closed
wants to merge 1 commit into from

Conversation

vaakian
Copy link
Contributor

@vaakian vaakian commented Dec 25, 2022

Description

replaced by #2600 馃憤

fixes #2565
fixes #2214

The PR #2540 has actually broken the functionality.

See the demos in current docs, it doesn't update state on blur:

By the description in #2540, the activeElement will be the <body /> in between(when focus from one element to another element, which will trigger an extra useless update).
This PR is fixing it by using a schedular that triggers the getter at next render.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@dpschen
Copy link
Contributor

dpschen commented Dec 30, 2022

@vaakian Hey,
I'm so sorry for introducing this bug. When I wrote the PR I translated a composable that I wrote myself in my head to the one of vueuse and by doing this I ignored the relatedTarget if it is not set instead of ignoring it if is set.

I fixed that in #2600

This time I tried it out, seems like it works.
Since that doesn't need a scheduled update I think it's slightly better than your approach. What do you think?

@vaakian
Copy link
Contributor Author

vaakian commented Dec 30, 2022

@vaakian Hey,

I'm so sorry for introducing this bug. When I wrote the PR I translated a composable that I wrote myself in my head to the one of vueuse and by doing this I ignored the relatedTarget if it is not set instead of ignoring it if is set.

I fixed that in #2600

This time I tried it out, seems like it works.

Since that doesn't need a scheduled update I think it's slightly better than your approach. What do you think?

I agree with that, Well done! 馃憤

@vaakian vaakian closed this Dec 30, 2022
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.

useFocus doesn't update on blur useFocusWithin gives incorrect values
2 participants