Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions background-material/explainer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# background-material Explainer

## Problem

Installed web apps cannot use OS-native translucent/material window frames, and HTML elements cannot request native material backplates.

## Goals

- Allow installed web apps to opt into material-backed window frames.
- Provide a CSS property for material-backed page and element surfaces.
- Use abstract material names, not OS-specific names.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be open to both. There's going to be lot of arguments on this.

- Preserve fallback behavior on platforms that do not support real materials.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simply ignore the material property. Similar to old browsers that don't understand material-background.


## Non-goals

- Defining spatial layout.
- Exposing sampled environment data to script.
- Styling browser chrome.
- Standardizing vendor material names.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we do want to leave this open similar generic font names.


## Proposal

Manifest:

```json
{
"display": "standalone",
"background_material": "regular"
}
````

CSS:

```css
:root {
background-color: transparent;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the background-color doesn't have to be transparent for the material to work.

Suggested change
background-color: transparent;

background-material: regular;
}

.panel {
background-material: regular;
border-radius: 12px;
}
```

Initial values:

```css
none | transparent | thin | regular | thick
```

## Why manifest + CSS?

The manifest opt-in gates top-level window transparency because it affects OS-level app chrome and has spoofing risk.

CSS controls the actual visual treatment after the app has opted in.

## Relationship to backdrop-filter

[`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter) samples DOM content behind an element.

`background-material` samples the OS/environment surface behind the web surface where the UA supports that composition.

For normal opaque browser tabs, authors should generally use [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter).

## Prior work

* [Microsoft Edge Materials in Web Applications explainer](https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Materials/explainer.md)
* [WebSpatial `background-material` API](https://webspatial.dev/docs/api/react-sdk/css-api/background-material)
* [CSS Spatial Layout Module Level 1 explainer](https://webkit.github.io/explainers/css-spatial/Overview.html)
* [Web App Manifest](https://www.w3.org/TR/appmanifest/)
* [WICG](https://wicg.io/)

## Open questions

* Final value vocabulary.
* Whether per-element rendering is required or optional.
* Fallback behavior when real materials are unavailable.
* Interaction with [`prefers-reduced-transparency`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-transparency).
* Contrast/accessibility guidance.
* Feature detection using [`@supports`](https://developer.mozilla.org/en-US/docs/Web/CSS/@supports) and/or a media feature.