Open Bug 1861266 Opened 11 months ago Updated 11 months ago

Wrong event.target in dialog element when using formassociated custom element

Categories

(Core :: DOM: Events, defect)

Firefox 119
Desktop
All
defect

Tracking

()

Tracking Status
firefox121 --- affected

People

(Reporter: evertjan.garretsen, Unassigned)

References

(Blocks 1 open bug)

Details

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

Steps to reproduce:

Whenever "static formassociated = true;" is used in a custom element, a event listener listening to click events (via event delegation) gets the wrong "event.target" when the click is inside in a dialog element within that custom element. This does not happen in Chrome, Safari, or Edge. Only in Firefox.

I created a github repo that demonstrates the bug. It's kinda hard to explain in text, easy to see when demonstrated.

git@github.com:evertjanMlbrgn/DialogCloseBug.git

Actual results:

The click event listener gets the wrong event.target and doesn't close the dialog as a result of that.

Expected results:

The click event listener should get the correct event.target and then the code will be able to close the dialog.

Sorry i copied the ssh link to my repo. The https link is https://github.com/evertjanMlbrgn/DialogCloseBug.git

Safari doesn't work at all i just discovered. Chrome and Edge work perfectly.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Events' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Events
Product: Firefox → Core

Hello I have managed to reproduce the issue with firefox 121.0a1(2023-11-07) on Ubuntu 22.04 and MacOS 12 with the link provided in comment 1. I will mark this issue as NEW in order to get our developers involved.

Have a nice day!

Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → All
Hardware: Unspecified → Desktop
Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.