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

BodyScroll and safe-area-env #218

Open
nycco opened this issue Dec 21, 2023 · 1 comment
Open

BodyScroll and safe-area-env #218

nycco opened this issue Dec 21, 2023 · 1 comment

Comments

@nycco
Copy link

nycco commented Dec 21, 2023

Hello,
Thank you so much for your React PWA project with Vite! It's an excellent foundation! I would like to seek your expertise on two specific points:

Disabling bodyscroll on Safari iOS:
I’ve tried various approaches to disable body scrolling on Safari iOS, but so far, I haven't found a satisfactory solution. Do you have any recommendations or tips on how to achieve this effectively? The goal is to have the app behave like a Native app.

Using environment variables for the body's safe area:
To ensure better integration with smartphones and their notches, I'm looking for a clean way to use environment variables to handle the body's safe area in the PWA. Do you have any advice or best practices to share on this matter?

Thank you very much!

@MengLinMaker
Copy link
Owner

MengLinMaker commented Dec 28, 2023

Hi nycco,

I appreciate your feedback.
I'm not sure if I understood your questions:

1. Disabling bodyscroll on Safari iOS:
1.1 Did you want to remove the scroll bar? - refer to this
1.2 Hiding overflowed content?

2. Using environment variables for the body's safe area:
No idea what you mean by environment variables - this usually refers to the variables defined in a ".env" file.

With the "safe-area", I find any HTML elements placed near the top of the webpage to behave well.
The phone will automatically resize the view height and width if CSS specifies "width: 100vw" and "height: 100vh"

Adding sticky footers is tricky.
There are new CSS units designed to deal with changing viewport heights: dvh, lvh, svh
I've tried them, but dvh does not resize to "safe-area" as expected on iOS safari.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants