Bug 197743 - document.elementsFromPoint does not return <label> parent of <input>
Summary: document.elementsFromPoint does not return <label> parent of <input>
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-05-09 11:04 PDT by Steven
Modified: 2022-08-11 14:43 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven 2019-05-09 11:04:31 PDT
In Safari 12 and Technology Preview, if a `<label>` element wraps an `<input>` element (`<label>Label text<input/></label>`), using `document.elementsFromPoint` with the x and y coordinates set to the `<input>` elements position does not return the parent `<label>`. If instead the `<label>` has a background color, the `<label>` then will be returned.

See https://codepen.io/straker/pen/qGbMvJ
Comment 1 Radar WebKit Bug Importer 2019-05-12 15:01:08 PDT
<rdar://problem/50708365>
Comment 2 Ahmad Saleem 2022-08-11 14:42:52 PDT
Output from all browsers (for broken test case because Comment 0 mentions that "background color" one works):

*** Safari 15.6 on macOS 12.5 ***

input
label#element-a
div
body
html

*** Firefox Nightly 105 ***

    input
    label#element-a
    div
    body
    html

*** Chrome Canary 106 ***

input
label#element-a
div
body
html

_________-

Since all browsers are same and showing label value at same place, I am going to mark this "RESOLVED CONFIGURATION CHANGED" because it seems to be something fixed along the way.

If I am wrong, please reopen this bug with explanation or updated test case. Thanks!