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

[cssom-view] Should table rows be returned by elementFromPoint & elementsFromPoint? #4182

Open
chrishtr opened this issue Aug 9, 2019 · 5 comments

Comments

@chrishtr
Copy link
Contributor

chrishtr commented Aug 9, 2019

https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint

According to the spec, step 2 of the algorithm is to look for a layout box "that would be a target for hit testing".

Currently, Chromium, Gecko and Webkit do not return table rows from elementsFromPoint.

Should we? It seems the answer has to do with hit testing, which has no spec.

@progers
Copy link
Contributor

progers commented Aug 11, 2019

In https://crbug.com/647594#c17 it was found that <tr>, <tbody>, <thead>, and <tfoot> are not included in elementsFromPoint by Chromium and Gecko. Elements with the equivalent display values (display: table-row, display: table-row-group, display: table-header-group, and display: table-footer-group) are not included in elementsFromPoint by Chromium, but are included in elementsFromPoint by Gecko.

The cssom-view spec issue "The terms CSS layout box and SVG layout box are not currently defined by CSS or SVG." seems related to this issue.

@atotic
Copy link
Contributor

atotic commented Mar 20, 2021

Tested behavior of elementsFromPoint inside true tables, dom tables, and anonymous tables.

FF86, Chrome 88, Safari 14, IE 17, and IE 11 all agree:

  • rows and sections are never returned by elementsFromPoint.
  • anonymous tables are not returned by elementsFromPoint.

It looks like this is the defacto standard.

Attached the test file used that is compatible with IE11.

test.txt

@tabatkins
Copy link
Member

It's pretty weird that those internal table elements aren't returned; they have dimensions and positions that should overlap with the point. I feel like we shouldn't go for bugward compat here unless it proves necessary (which I suspect is unlikely).

@atotic
Copy link
Contributor

atotic commented Mar 23, 2021

It is weird, and I've seen bugs filed about this. It makes implementation more complex.

If you believe that returning rows & sections has a shot at being web compatible, we could try it out.

@b-houghton
Copy link

I ran into this today. I had used elementsFromPoint with the expectation that it would return all elements at the given point. I would like to advocate for that behavior, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants