Skip to content

Commit 67163bf

Browse files
authored
Fix position fixed causing layout shifts on standalone sites (pwa) (#277)
1 parent 7a398eb commit 67163bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/use-position-fixed.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ export function usePositionFixed({
9696
if (nested || !hasBeenOpened) return;
9797
// This is needed to force Safari toolbar to show **before** the drawer starts animating to prevent a gnarly shift from happening
9898
if (isOpen) {
99-
setPositionFixed();
99+
// avoid for standalone mode (PWA)
100+
const isStandalone = window.matchMedia('(display-mode: standalone)').matches;
101+
!isStandalone && setPositionFixed();
100102

101103
if (!modal) {
102104
setTimeout(() => {

0 commit comments

Comments
 (0)