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

Date Picker popup doesn't propagate shadow DOM events into the light DOM #10343

Open
teetotum opened this issue May 13, 2024 · 1 comment
Open

Comments

@teetotum
Copy link

What is the issue with the HTML Standard?

It seems the input type="date" standard does not specify whether or not any DOM events (click, keydown, etc) originating in the picker popup shadow DOM should be created with composed = true.

General developer documentation regarding UA generated events inside shadow DOM suggests that such events should be observable by event listeners in the regular DOM (i.e. light DOM) and therefore composed = true.

All UA-dispatched UI events are composed (click/touch/mouseover/copy/paste, etc.).
https://developer.mozilla.org/en-US/docs/Web/API/Event/composed

A quick test with chrome and firefox showed that (in at least those two browsers) currently no shadow DOM events are propagated.

<input type="date" id="input" />
<script>
  const input = document.getElementById("input");
  input.addEventListener("keydown", (e) => { console.log("bubbling keydown " + e.key); });
  input.addEventListener("keydown", (e) => { console.log("capturing keydown " + e.key); }, { capture: true });
  input.addEventListener("click", (e) => { console.log("bubbling click"); });
  input.addEventListener("click", (e) => { console.log("capturing click"); }, { capture: true });
</script>

User expectation (I currently have a sample size of 1 (just myself)) is that the user interaction with the date picker popup is observable in the light DOM.
Are there any security concerns forbidding such a motion?

At the moment I'm not sure whether this is just a gap in the specification or should be treated as a bug in the tested browsers.

@annevk
Copy link
Member

annevk commented May 13, 2024

Behavior for internal shadow roots is not specified to this extent. Furthermore, form controls and definitely their pickers are UI which makes requiring uniform behavior not really tenable.

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

No branches or pull requests

2 participants