Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-env] Add environment variable for left/right bounds of notch #4721

Open
amandabaker opened this issue Jan 31, 2020 · 0 comments
Open

[css-env] Add environment variable for left/right bounds of notch #4721

amandabaker opened this issue Jan 31, 2020 · 0 comments

Comments

@amandabaker
Copy link

amandabaker commented Jan 31, 2020

CSS Environment Variables

On mobile devices with notches, developers can use the safe-area-inset-* environment variable to shift the web content and ensure that all content is hidden behind the notch. However, with limited space on small devices, developers want to be able to place content in the area next to the notch as well.

This is something that we would also like to use in our proposed feature for Title Bar Customization in PWAs. If we treat the caption control overlay proposed in the document like a notch, then these new CSS variables would make it easier for developers to style the remaining area next to the overlay.

Although using shape-inside and shape-outside would provide a more accurate representation of the notch, these have not yet been implemented in Chromium or Safari. Below is a less robust, but simpler solution to working around a notch

Proposal:

Following the pattern of safe-area-inset-*s, we propose new CSS environment variables to define the insets of the unsafe notch area in more detail: 

  • Horizontal insets of the notch on the top edge of the screen
      - unsafe-area-top-inset-left
      - unsafe-area-top-inset-right
    - Horizontal insets of the notch on the bottom edge of the screen
      - unsafe-area-bottom-inset-left
      - unsafe-area-bottom-inset-right
    - Vertical insets of the notch on the left edge of the screen
      - unsafe-area-left-inset-top
      - unsafe-area-left-inset-bottom
    - Vertical insets of the notch on the right edge of the screen
      - unsafe-area-right-inset-top
      - unsafe-area-right-inset-bottom

For example, when defining a notch on the top of the screen, you can define its position via the insets from the edges of the window:
  - top inset: 0
  - left inset: env(unsafe-area-top-inset-left)
  - bottom inset: env(safe-area-inset-top)
  - right inset: env(unsafe-area-top-inset-right)

unsafe-area-insets

amandabaker added a commit to MicrosoftEdge/MSEdgeExplainers that referenced this issue Mar 3, 2020
…le bar (#212)

Update explainer to use and explain new CSS environment variables: `unsafe-area-top-inset-left/right`. 

CSS working group proposal: 
- [[css-env] Add environment variable for left/right bounds of notch](w3c/csswg-drafts#4721)

Related issues: 
- #177 Title bar customization: new CSS properties for easier layout
- #203 [Title Bar Customization] Consider using css env variables for `controlsOverlay` bounding rect
ElormCoch pushed a commit to ElormCoch/MSEdgeExplainers that referenced this issue Sep 5, 2023
…le bar (MicrosoftEdge#212)

Update explainer to use and explain new CSS environment variables: `unsafe-area-top-inset-left/right`. 

CSS working group proposal: 
- [[css-env] Add environment variable for left/right bounds of notch](w3c/csswg-drafts#4721)

Related issues: 
- MicrosoftEdge#177 Title bar customization: new CSS properties for easier layout
- MicrosoftEdge#203 [Title Bar Customization] Consider using css env variables for `controlsOverlay` bounding rect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants