google / google/material-design-lite

Reduce "magic" and mandatory JS

Open
#1,732 6 comments 3 reactions 0 assignees View on GitHub
2.0 Big Themes P0
Dominant language
HTML
Stars
32.2k
Forks
4.9k
PR merge metrics
No merged PRs in 30d

Description

MDL does a lot of work for the user, sometimes too much so. We should opt for boilerplate over doing to much in the background:
- MDL shouldn't add or remove elements to the DOM when upgrading components, particularly if the new elements are created around the user-specified ones (see e.g. `mdl-layout__container`). This complicates debugging and customisation, by making the DOM different from the markup the user provided.
- All markup needed for the component to work should be provided by the user. If something is not present, the component should continue working if possible, or throw an explicit error if not.
- Interaction between components or conceptually separate elements within a component should be explicitly declared by the user (e.g. using a `data-mdl-for` attribute). This allows for users to override click handlers, for example, while still retaining style and positioning.
- Adding or removing CSS classes to existing elements from JS is ok, and should be the main interaction between CSS and JS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.