fix(web): size the app to the dynamic viewport on mobile Safari - #3647
Open
PiedPiper911 wants to merge 1 commit into
Open
PiedPiper911 wants to merge 1 commit into
PiedPiper911 wants to merge 1 commit into
Conversation
On mobile Safari the URL bar/toolbar are included in the 100vh calculation, so the app was taller than the visible viewport: the page scrolled as a document and the sidebar footer (user avatar / notifications) sat below the fold. Switching the layout containers to the dynamic viewport unit (100dvh) keeps the app exactly the height of the visible viewport while the browser chrome animates. Closes teableio#3642
|
|
Author
|
Added a local build check to confirm these utilities are generated by the Tailwind version this repo pins ( .h-dvh { height: 100dvh }
.min-h-dvh { min-height: 100dvh }
.h-screen { height: 100vh }
.min-h-screen { min-height: 100vh }So |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3642
Problem
On mobile Safari (iPad, and iPhone) the URL bar / toolbar are part of the viewport that
100vhresolves against, so containers sized withh-screen/min-h-screenend up taller than the actually visible area. The app then scrolls as a document: with the toolbar visible the sidebar footer (user avatar + notifications) sits below the fold, and scrolling the browser chrome away pushes the top bar out of view instead.Fix
Use the dynamic viewport unit (
100dvh— Tailwindh-dvh/min-h-dvh) for the layout and full-height page containers, so their height tracks the visible viewport as the browser chrome animates:components/layout/MainLayout.tsx— the app shellfeatures/app/layouts/SpaceLayout.tsx,SettingLayout.tsx— the#portallayoutsfeatures/auth/components/LayoutMain.tsx,features/auth/pages/LoginPage.tsx,features/app/waitlist/WaitlistPage.tsx,features/app/blocks/share/...— full-height auth / waitlist / share pagesstyles/global.css— the top-banner compensation rules are keyed on.h-screen/.min-h-screenand subtract--teable-top-banner-height; they are updated to the new class names and unit so the banner offset keeps workingWhy
dvhdvhis supported by iOS Safari 15.4+, Chrome 108+ and Firefox 101+ (≈97% global baseline), and this repo already usesdvhunits elsewhere (packages/sdk,packages/ui-lib), so this follows existing practice rather than introducing a new convention.Notes
dvhequalsvhwhen there is no dynamic browser chrome.h-screeninside individual components is left as-is.vhas a fallback declaration.