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

useMouseInElement is not updating correctly on scroll for static element #2922

Closed
7 tasks done
jbreuil opened this issue Mar 31, 2023 · 2 comments
Closed
7 tasks done

Comments

@jbreuil
Copy link

jbreuil commented Mar 31, 2023

Describe the bug

While useMouse is totally correct to not update x or y value on scroll, this is not what should happen for the value of elementX, elementY and isOutside on useMouseInElement when the element is not sticky.

If I scroll on a page the position of the mouse is not changing which is correct, but scrolling move elements in the page thus changing the position of the mouse in this element.
Since useMouseInElement is not updating elementX, elementY and isOutside, on scroll they end up been false.

To reproduce the problem you can use the doc :

place your cursor in the element then scoll, the elementX, elementY are not updating and if you scroll until the cursor is out of the element isOutside is still at false.

Reproduction

https://vueuse.org/core/useMouseInElement/

System Info

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1
    Memory: 119.64 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  Browsers:
    Chrome: 111.0.5563.146
    Firefox: 111.0
    Safari: 16.3
  npmPackages:
    @vueuse/core: ^9.13.0 => 9.13.0 
    vue: ^3.2.47 => 3.2.47

Used Package Manager

pnpm

Validations

@smallnine9
Copy link
Contributor

In fact, useMouse in element not window will also encounter this problem.
Even we scroll the mouse in element, the x and y will not update.

@stale
Copy link

stale bot commented Jul 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

2 participants