Comments (5)
First, to use last version of materialize, you should use scripts from
https://www.jsdelivr.com/package/npm/@materializecss/materialize
For the shadow-dom problem, I think it is because card component is using this for the click event:
document.addEventListener("DOMContentLoaded", () => {
document.body.addEventListener('click', e => {
const trigger = <HTMLElement>e.target;
const card: HTMLElement = trigger.closest('.card');
if (!card) return;
And the target element in a shadow-dom is the shadowRoot, not the card element (see Shadow DOM and events)
I'm not sure of what will be the solution. Maybe the proper solution will be to convert every component to a custom element but this would be a big change and I'm not sure of the implications.
from materialize.
Well, thanks for the Info :) I will try to See What I can do with that.
from materialize.
Hi, I feel bad for around 10 months of inactivity.
I can see well in the dev tools that the card don't register an event inside a shadow root. About the waves, it might be similar.
As explained in the original issues, this might be related to how materialize selects events.
Unfortunately I don't know enough, and I don't have free time to investigate more. Added the bug label.
Feel free to reply if you can help to any ways.
from materialize.
Is there any plan on supporting webcomponents, especially the shadow root?
from materialize.
A possible solution could be this:
change the static init of the components:
static Init() {
document.addEventListener("DOMContentLoaded", () => {
document.body.addEventListener('click', e => {
const trigger = <HTMLElement>e.target;
with something like this:
static Init(rootElement = null) {
if (rootElement == null)
rootElement = document.body
document.addEventListener("DOMContentLoaded", () => {
rootElement.addEventListener('click', e => {
const trigger = <HTMLElement>e.target;
This will maintain backward compatibility and you can call the init method with the shadowRoot (for each card in a different shadow DOM).
from materialize.
Related Issues (20)
- [Bug]: Autocomplete size ist not correct sometimes HOT 1
- Difference Slider and Carousel? HOT 5
- [Bug]: Textarea not autoresize HOT 4
- [Bug]: Materialize Select auto scroll to top on Safari HOT 2
- [Bug]: Collapsible looks/behaviour changed in version 2.0.3 HOT 1
- .show-on-medium-and-up vs .hide-on-med-and-up HOT 1
- [Bug]: Autocomplete issues HOT 1
- [Bug]: Failed to resolve entry for package "@materializecss/materialize HOT 5
- [Bug]: Clicking on a dropdown trigger twice+ times consecutively causes unexpected results HOT 6
- Creating Components via JavaScript HOT 4
- [Bug]: Dropdown + Window Resize
- Microsoft Defender Antivirus detects "Trojan:Script/Wacatac.H!ml" HOT 8
- [Bug]: Select Options does not overflow cards
- [Bug]: Range input appearance not work on chrome 123, but work on Firefox
- [Bug]: TimePicker is completely broken
- [Bug]: Modal with Fixed Footer Always has Scrollbar HOT 1
- [Bug]: Tonal button seems not presenting HOT 1
- [Bug]: Autocomplete selectOption does nothing HOT 2
- Add "RAIL" material 3 HOT 3
- Marquee Component HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from materialize.