Open Bug 1468825 Opened 6 years ago Updated 2 years ago

document.elementsFromPoint skips children inside of button element

Categories

(Core :: DOM: Core & HTML, defect, P3)

59 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: marcy.sutton, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

Steps to reproduce:

1. Mark up element hierarchy in HTML using button & span structure, along with DIV & span structure for comparison
2. Query the DOM to get references to child spans
3. Get element coordinates with span[i].getBoundingClientRect()
4. Pass coordinates to document.elementsFromPoint(), repeat for each child element under test
5. Compare stack results for button > span to other combinations


Actual results:

For some reason Firefox is not returning child elements inside of <button> with document.elementsFromPoint. Other parent elements are fine, including DIVs and anchors. The style and tagName of children inside of the button doesn't seem to make any difference–they can be display: inline or block, and Firefox still skips them. Using coordinates in the center of the child element instead of the top left corner makes no difference either.


Expected results:

For the boundingClientRect coordinates of a given child element, regardless of tagName, the expectation (and behavior in Chrome) is that the child element itself be returned in the element stack. This is important for color contrast testing, where the stack of elements for a set of x,y coordinates needs to include the child element under test if it overlaps.
Bases on other similar reports I think the correct component would be Core::Dom:Core&HTML. Please change if this is not the right component.
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: