Open CorporateDrone opened 4 years ago
Correct me if I'm wrong, but shouldn't the data-mdc-auto-init="MDCList"
be put on the list parent rather than the list item? (See the docs here: https://material.io/develop/web/components/lists/#javascript)
That way you can still bind the MDCRipple
to the elements.
So the format would be like this:
<ul class="mdc-list" data-mdc-auto-init="MDCList">
<li class="mdc-list-item" data-mdc-auto-init="MDCRipple">
<span class="mdc-list-item__text">Item 1</span>
</li>
<li class="mdc-list-item" data-mdc-auto-init="MDCRipple">
<span class="mdc-list-item__text">Item 2</span>
</li>
</ul>
Feature Request
When using auto-init to register a component,
data-mdc-auto-init
can contain a single value. Allowdata-mdc-auto-init
attribute to contain multiple values to be instantiated. This will allow a mdc-list item to be instated and also instantiate the ripple effect for the component.Proposed solution
Allow multiple values to be added to the data-mdc-auto-init and be parsed upon processing For example:
<li class="mdc-list-item" data-mdc-auto-init="MDCList MDCRipple">
Alternatives considered
Instantiating the ripple effect afterwards is possible, but defeats the purpose of the mdc-auto-init convenience.