[screen-wake-lock] An element attribute proposal for increasing screen brightness (#348)

beaufortfrancois has just created a new issue for https://github.com/w3c/screen-wake-lock:

== An element attribute proposal for increasing screen brightness ==
Following [TPAC Devices and Sensors WG discussion](https://www.w3.org/2022/09/15-dap-minutes.html#t20), this issue explores a  **declarative approach** for allowing web developers to ask the browser to increase the screen brightness.

An element attribute proposal was [suggested](https://www.w3.org/2022/09/15-dap-minutes.html#t20:~:text=could%20be%20an-,element%20attribute,-as%20well). Let's call it `increaseBrightness` for now. Naming is hard. 🚲

## Proposal

```webidl
[Exposed=Window]
partial interface Element {
  [Reflect] attribute boolean increasebrightness;
}
```

## Example

```html
<div id="my-qr-code" increasebrightness>
    <img src="qrcode.png" width="256" height="256">
</div>
```

## Feature support

You can check for this element attribute support with:

```js
const supported = Element.prototype.hasOwnProperty("increaseBrightness");
```

## Behaviour

When an element with the `increaseBrightness` attribute becomes visible to the user, the browser would take care of boosting the screen region that matches the element bounds OR increasing the overall screen brightness level if the device does not support partial screen brightness boosting.

Only elements with the `increaseBrightness` attribute would trigger this behaviour. This way, web pages such the [Wikipedia QR code article](https://en.wikipedia.org/wiki/QR_code), would not suffer from automatic detection. 

## Security and privacy considerations

To increase screen brightness, the browser MUST first check:

- The website is in a secure browsing context.
- The element is NOT in a cross-origin iframe.
- The element is visible.
- The visible size of the element is large enough (more than a quarter of the screen size).

It MAY deny the request if:

- The content is not a "scannable" element (e.g. QR code, barcode).

The screen brightness is restored automatically when:

- The page visibility becomes hidden.
- The element is not visible.
- The visible size of the element becomes too small (less than a quarter of the screen size).
- The website abuses of the element attribute and fires too many requests.

To avoid possible user fingerprinting issues, a website is not able to detect when screen brightness is increased.

## Open design issues

The following issues (on top of [the existing ones](https://github.com/w3c/screen-wake-lock/blob/gh-pages/brightness-mode-explainer.md#open-design-issues)) remain open for discussion:

- Unlike other proposals, the screen brightness can be increased without a user gesture. Shall we require one?
- What happens when there are multiple elements with the `increaseBrightness` attribute? Shall we boost both partial screen regions or one only?

Please view or discuss this issue at https://github.com/w3c/screen-wake-lock/issues/348 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 16 September 2022 08:25:49 UTC