fix(pwa): restore ios safe area regression

This commit is contained in:
7w1 committed 2026-07-19 15:35:25 -05:00
1 parent 3ea5cef5ca
commit 9a57338932
3 files changed
+18 -9

No files matched your search

@@ -27,7 +27,7 @@ describe('SystemBarShell', () => {
const mutationObserver = vi.fn<() => void>();
vi.stubGlobal('MutationObserver', mutationObserver);
render(
const { container } = render(
<SystemBarShell onPortalContainerChange={vi.fn<(node: HTMLDivElement | null) => void>()}>
<div>Content</div>
</SystemBarShell>
@@ -35,5 +35,9 @@ describe('SystemBarShell', () => {
expect(mockOsType).not.toHaveBeenCalled();
expect(mutationObserver).not.toHaveBeenCalled();
expect(container.querySelector('[data-system-bar-position="top"]')).toHaveStyle({
height: 'var(--safe-area-inset-top, env(safe-area-inset-top, 0px))',
});
expect(container.querySelector('[data-system-bar-position="bottom"]')).not.toBeInTheDocument();
});
});
@@ -99,16 +99,19 @@ function useBarColor(
}
type SystemBarStripProps = {
edge: 'top' | 'bottom';
size: string;
background: string;
stripRef?: RefObject<HTMLDivElement>;
transition?: string;
};
function SystemBarStrip({ size, background, stripRef, transition }: SystemBarStripProps) {
function SystemBarStrip({ edge, size, background, stripRef, transition }: SystemBarStripProps) {
return (
<div
ref={stripRef}
aria-hidden="true"
data-system-bar-position={edge}
style={{
height: size,
flexShrink: 0,
@@ -143,13 +146,12 @@ export function SystemBarShell({ children, onPortalContainerChange }: SystemBarS
return (
<>
{enabled && (
<SystemBarStrip
size={safeAreaTop}
background={topColor ?? 'var(--sable-bg-container)'}
stripRef={topStripRef}
/>
)}
<SystemBarStrip
edge="top"
size={safeAreaTop}
background={topColor ?? 'var(--sable-bg-container)'}
stripRef={topStripRef}
/>
<div
style={{
@@ -180,6 +182,7 @@ export function SystemBarShell({ children, onPortalContainerChange }: SystemBarS
{enabled && (
<SystemBarStrip
edge="bottom"
size={tauriOs === 'ios' ? iosBottomInset : safeAreaBottom}
background={bottomColor ?? 'var(--sable-surface-container)'}
stripRef={bottomStripRef}
+2
View File
@@ -55,6 +55,8 @@ describe('android edge-to-edge inset contract', () => {
expect(systemBarShell).toContain(
'var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))'
);
expect(systemBarShell).toContain('<SystemBarStrip\n edge="top"');
expect(systemBarShell).toContain('{enabled && (\n <SystemBarStrip\n edge="bottom"');
expect(mobileCapability).toContain('"edge-to-edge:default"');
});