Skip to content

Commit

Permalink
Fix position fixed causing layout shifts on standalone sites (pwa) (#277
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Cuzart authored Apr 6, 2024
1 parent 7a398eb commit 67163bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/use-position-fixed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ export function usePositionFixed({
if (nested || !hasBeenOpened) return;
// This is needed to force Safari toolbar to show **before** the drawer starts animating to prevent a gnarly shift from happening
if (isOpen) {
setPositionFixed();
// avoid for standalone mode (PWA)
const isStandalone = window.matchMedia('(display-mode: standalone)').matches;
!isStandalone && setPositionFixed();

if (!modal) {
setTimeout(() => {
Expand Down

0 comments on commit 67163bf

Please sign in to comment.