Skip to content

Commit fb4c932

Browse files
committed
Stop using env var keyboard-inset-height
1 parent 4933955 commit fb4c932

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/SheetContent.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,9 @@ export const SheetContent = forwardRef<any, SheetContentProps>(
7070

7171
if (sheetContext.avoidKeyboard) {
7272
if (disableScroll) {
73-
contentStyle.paddingBottom =
74-
'env(keyboard-inset-height, var(--keyboard-inset-height, 0px))';
73+
contentStyle.paddingBottom = 'var(--keyboard-inset-height, 0px)';
7574
} else {
76-
scrollStyle.paddingBottom =
77-
'env(keyboard-inset-height, var(--keyboard-inset-height, 0px))';
75+
scrollStyle.paddingBottom = 'var(--keyboard-inset-height, 0px)';
7876
}
7977
}
8078

src/hooks/use-virtual-keyboard.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,12 @@ export function useVirtualKeyboard({
6262
const vk = (navigator as any).virtualKeyboard;
6363

6464
function setKeyboardInsetHeightEnv(height: number) {
65-
// Virtual Keyboard API is only available in secure context
66-
if (window.isSecureContext) {
67-
containerRef.current?.style.setProperty(
68-
'--keyboard-inset-height',
69-
`env(keyboard-inset-height, ${height}px)`
70-
);
71-
} else {
72-
containerRef.current?.style.setProperty(
73-
'--keyboard-inset-height',
74-
// Safari 26 uses a floating address bar when keyboard is open that occludes the bottom of the sheet
75-
// and its height is not considered in the visual viewport. It is estimated to be 25px.
76-
`${isIOSSafari26() ? (height ? height + 25 : 0) : height}px`
77-
);
78-
}
65+
containerRef.current?.style.setProperty(
66+
'--keyboard-inset-height',
67+
// Safari 26 uses a floating address bar when keyboard is open that occludes the bottom of the sheet
68+
// and its height is not considered in the visual viewport. It is estimated to be 25px.
69+
`${isIOSSafari26() ? (height ? height + 25 : 0) : height}px`
70+
);
7971
}
8072

8173
function handleFocusIn(e: FocusEvent) {

0 commit comments

Comments
 (0)