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

fix(PageLayout): use dvh to support the correct height on iOS devices #2251

Merged
merged 7 commits into from
Oct 3, 2022

Conversation

joshblack
Copy link
Member

Closes https://github.com/github/primer/issues/1211

This PR updates the useStickyPaneHeight hook in PageLayout to use dvh for values, if it's supported on the user's device.

Note: this property seems to have a regression in Safari 15.6: https://bugs.webkit.org/show_bug.cgi?id=242758

Screenshots

For a quick overview of dvh:

image

This behaves as intended except for Safari on macOS. It seems like Safari is including the height of the title bar in this situation instead of the intended height (based on the height difference being the same height as the title bar).

It seems like this bug is captured over in: https://bugs.webkit.org/show_bug.cgi?id=242758 and was a regression in Safari 15.6

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
    • iOS Safari
  • Tested in Edge

@joshblack joshblack requested review from a team and rezrah August 22, 2022 18:25
@changeset-bot
Copy link

changeset-bot bot commented Aug 22, 2022

🦋 Changeset detected

Latest commit: e907718

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Aug 22, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 77.18 KB (+0.11% 🔺)
dist/browser.umd.js 77.81 KB (+0.14% 🔺)

@colebemis
Copy link
Contributor

From the testing @joshblack and I did, it looks like the experience of using 100vh on Mobile Safari is not as bad as the experience of using 100dvh on Desktop Safari. I vote to delay using dvh until Apple fixes the dvh bug in Safari 15.6+. How does that sound @vdepizzol @joshblack?

@siddharthkp siddharthkp requested review from colebemis and removed request for rezrah August 23, 2022 15:31
@joshblack
Copy link
Member Author

Notes

  • Can we be smarter about how we target dvh so that it works on iOS/iPadOS?
    • @supports (-webkit-touch-callout: none) { } is specific to mobile safari
  • Can we sniff the user agent to know the current device/browser/platform?
  • Instead of checking support for dvh, limit support for dvh on mobile (specifically iPadOS)

If we cannot do any of above, prioritize the desktop experience

@joshblack
Copy link
Member Author

Added a quick check for the touch-callout property and should be good to go!

@joshblack joshblack temporarily deployed to github-pages September 28, 2022 18:28 Inactive
@joshblack joshblack temporarily deployed to github-pages October 3, 2022 16:28 Inactive
@joshblack joshblack temporarily deployed to github-pages October 3, 2022 16:38 Inactive
Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

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

Nice work, @joshblack! Ship it 🚢

@joshblack joshblack merged commit 4a4e47c into main Oct 3, 2022
@joshblack joshblack deleted the 1211-update-vh-to-dvh branch October 3, 2022 20:03
@primer-css primer-css mentioned this pull request Oct 3, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants