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

elementFromPoint is not working #1400

Closed
danieldongit opened this issue Apr 10, 2024 · 3 comments
Closed

elementFromPoint is not working #1400

danieldongit opened this issue Apr 10, 2024 · 3 comments
Labels
bug Something isn't working easy fix good first issue Good for newcomers

Comments

@danieldongit
Copy link

Describe the bug
I am using vendor code that utilized the elementFromPoint function (Codemirror 6).

To Reproduce
Reproduction will take setting up codemirror in a development environment along with a testing framework.
Might be a bit of a process

Error Log

TypeError: root.elementFromPoint is not a function
posAtCoords node_modules/@codemirror/view/dist/index.js:3418:24
let doc = view.dom.ownerDocument;
let root = view.root.elementFromPoint ? view.root : doc;
let element = root.elementFromPoint(x, y);
@danieldongit danieldongit added the bug Something isn't working label Apr 10, 2024
@capricorn86
Copy link
Owner

Thank you for reporting @danieldongit! 🙂

As Happy DOM can't render the Elements, it doesn't know which element will be at the point, but it should be possible to add a method that just returns null.

public elementFromPoint(_x: number, _y: number): Element | null {
      return null;
}

@TreyVigus
Copy link
Contributor

Working on a PR for this now

TreyVigus pushed a commit to TreyVigus/happy-dom that referenced this issue Apr 27, 2024
TreyVigus added a commit to TreyVigus/happy-dom that referenced this issue Apr 27, 2024
TreyVigus added a commit to TreyVigus/happy-dom that referenced this issue Apr 27, 2024
TreyVigus added a commit to TreyVigus/happy-dom that referenced this issue Apr 27, 2024
capricorn86 added a commit that referenced this issue May 6, 2024
Co-authored-by: David Ortner <david@ortner.se>
@capricorn86
Copy link
Owner

Thank you for reporting @danieldongit! 🙂

Big thanks to @TreyVigus for contributing with a fix ⭐

https://github.com/capricorn86/happy-dom/releases/tag/v14.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy fix good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants