material-components / material-components/material-web

z-index management and isolation

Open
#4,146 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
11.3k
Forks
1.1k
Avg merge
20h 28m
Merged PRs (30d)
13

Description

I noticed there are some arbitrary z-index values hard-coded throughout the lib i.e. here:

https://github.com/material-components/material-web/blob/7368e2a2e23cd4509e27860ef513dd6fc832964a/menu/lib/_menu.scss#L66

Feel like this should be managed by a CSS var at the least. But y'all should consider implementing some small system to manage z-indicies. Otherwise it will lead to pain down the line, and be hard to work around for consumers.

[Also I would prefer `isolation: isolate;`](https://developer.mozilla.org/en-US/docs/Web/CSS/isolation) to using `z-index: 0;` if you can get away with it, as this isolates the stacking context without having the side effect of changing the actual `z-index`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing menu/lib/_menu.scss at the linked line and locating the other hard-coded z-index values mentioned in the issue. Compare the current z-index usage with CSS custom properties and isolation; the work is done when a documented, consistent management approach is agreed and applied across the affected styles.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, scss
Domain
design, frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.