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

[Bug]: Datepicker not working in ShadowRoot #352

Open
3 tasks done
Canabale opened this issue Mar 21, 2023 · 0 comments
Open
3 tasks done

[Bug]: Datepicker not working in ShadowRoot #352

Canabale opened this issue Mar 21, 2023 · 0 comments
Labels
bug Something isn't working component: dropdown

Comments

@Canabale
Copy link

Before submitting...

Context

Datepicker not working in shadowroot.

Current Behavior

When a datepicker is loaded in shadowroot, the queryselectors (including getElementById) will fail and cause errors.
Here is a codepen showing the issue:
https://codepen.io/Canabale/pen/OJoBRzQ

Expected behavior

Datepickers work exactly the same way, no matter whether you use them in a shadowroot or directly on the document.

Possible Solutions or Causes

There are definately multiple causes.
The biggest issues seem to be the following:

  1. The element queries (querySelector, querySelectorAll, getElementById) are exectued on the document instead of the shadowRoot, which is why elements are not found, resulting in nullreference errors.
  2. When elements are dynamically appended to the dom, they are also appended to the document instead of the shadowRoot.

Steps to reproduce

Here is a codepen showing the issue:
https://codepen.io/Canabale/pen/OJoBRzQ

Your Environment

  • Version used: 1.2.2
  • Browser Name and version: Edge, Chrome, Firefox (latest each)
  • Operating System and version (desktop or mobile): windows
  • Additional information you want to tell us: Materialize seems to be generally incompatible with shadowroot, which is a real shame....
@Canabale Canabale added the bug Something isn't working label Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: dropdown
Projects
None yet
Development

No branches or pull requests

2 participants