Skip to content

[@mantine/core] AppShell: Fix Navbar and Aside overlapping Footer safe area inset - #9512

Closed
clean99 wants to merge 4 commits into
mantinedev:masterfrom
clean99:contrib/appshell-footer-safe-area-offset
Closed

clean99 wants to merge 4 commits into
mantinedev:masterfrom
clean99:contrib/appshell-footer-safe-area-offset

Conversation

@clean99

@clean99 clean99 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9511

AppShell.Footer adds the bottom safe-area inset to its configured height, but Navbar, Aside, and Main did not reserve that extra space. This aligns the side sections with the footer and preserves Main's bottom padding, including when the footer is shorter than the inset.

  • Problem: with a 60px footer and a 34px bottom inset, Navbar and Aside overlap the footer by 34px on 9.8.3. The earlier min(inset, offset) fix still overlapped an 18px footer by 16px and gave Main 52px of bottom padding instead of 68px with padding={16}.
  • Change: reserve the full inset through a separate variable when a fixed footer has an enabled offset and is expanded. Inactive footers write an explicit zero in their generated scope, preventing scoped shells from inheriting another shell's reserve; disabled shells also reset it. The existing height and offset variables keep their meanings, including during resize previews. An enabled zero-height footer still reserves the inset; footer.offset: false disables the reserve. Navbar and Aside use bottom rather than a 100dvh-based height; static mode resets bottom to auto, and the edge still animates.
  • Reproduction: in the official FullLayout demo, set footer={{ height: 18 }} and padding={16}, leave both side sections visible, and set Chrome's bottom safe-area inset to 34px with Emulation.setSafeAreaInsetsOverride. At 1024×768, the side sections now end at the footer's top, y=716, and Main has 68px bottom padding. With height: { base: 18, md: 60 }, they also meet at y=716 at 840px wide and y=674 at 1024px wide.
  • Why bottom: the footer is anchored to its containing block, which can differ from 100dvh. On a 1024×768 page with a classic horizontal scrollbar and no inset, the footer starts at y=693 while the old navbar ends at y=708; anchoring both to the same bottom edge removes that overlap.
  • Behavior notes: without a footer, side sections now follow the containing block's bottom instead of a 100dvh height. Consumer overrides of h="auto", top, bottom, or non-fixed positioning interact with top + bottom rather than the old built-in height. Explicit heights and mah retain their behavior. layout="alt" retains full-height side sections; static layouts and inactive footer offsets retain their spacing.
  • Verification: npm run jest -- packages/@mantine/core/src/components/AppShell --runInBand passes (22 suites, 444 tests), including pure helper regressions for short, zero-height, responsive, resized, collapsed, and offset-disabled footers with explicit inactive resets. The mixed global/scoped collapsed-shell reproduction passes, and the built package passes 26 headless-Chrome layout scenarios with safe-area overrides of 0, 24, and 34px; six fail on the previously submitted head. jsdom cannot measure env() or element bounds. npm run setup, npm run build all, npm run test:esm-entrypoints, both documentation compilers, and npm test pass (830 suites, 20,005 tests).

The pre-existing 1px border floor on a zero-height client-rendered footer remains unchanged. Device testing and Firefox/iOS testing remain outside this verification.

@rtivital rtivital added ? and removed ? labels Dec 5, 2026
@rtivital

rtivital commented Dec 5, 2026

Copy link
Copy Markdown
Member

I reproduced #9511 on the base and confirmed that 2ee8da0eaa9d90de380b1541d8b8b6d749fcd8be fixes the official FullLayout demo: with a 60px footer and a 34px bottom safe-area inset, the navbar and aside now end at the footer’s top (y=674), instead of overlapping it by 34px.

I also reproduced the short-footer limitation you noted. In the default layout with footer={{ height: 18 }}, padding={16} and both side sections visible, I measured these element bounds in Chrome at 1024×768 using Emulation.setSafeAreaInsetsOverride:

Bottom inset Footer top Navbar and aside bottom Remaining overlap
0px 750px 750px 0px
24px 726px 732px 6px
34px 716px 732px 16px

With the 34px inset, Main’s bottom padding is 52px instead of 68px (18 + 34 + 16), so the last item sits flush against the footer when scrolled to the end. A responsive footer (height: { base: 18, md: 60 }) has the same 16px overlap at 840px wide, then fits at 1024px. min(inset, offset) caps the reserved inset at 18px in the failing cases. An offset-enabled footer needs to reserve its full inset even when its configured height is smaller.

@rtivital rtivital added the ? label Dec 5, 2026
@clean99

clean99 commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

Replaced the min(inset, offset) cap with a separate full-inset reserve for expanded, offset-enabled fixed footers. With an 18px footer, Navbar and Aside now meet the footer at y=726 for a 24px inset and y=716 for a 34px inset, with Main padding of 58px and 68px respectively; the responsive 840px/1024px cases and resize previews also pass. Inactive footers explicitly reset the reserve in their generated scope, so a collapsed resizable shell no longer inherits another shell’s inset. Fixed shells without resize still share :root, so with two of them on one page a later footerless shell resets this reserve for the other one; a shell with resize uses its own scope and is unaffected. Added pure helper regression tests for that reset; all 29 helper tests and the full 20,005-test suite pass. The pre-existing 1px border floor on a zero-height client-rendered footer remains outside this change.

@clean99

clean99 commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for reproducing and measuring this. 877c34b now reserves the full safe-area inset for short and responsive footers, which covers #9511, so this PR is superseded and I'm closing it.

One separate case still overlaps on current master: with a classic (non-overlay) horizontal scrollbar, the navbar and aside run 15px into the footer. The bottom-anchor change in this branch fixed that case, but it breaks height transitions when h is added or removed, so it is left out rather than widening this PR.

@clean99 clean99 closed this Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppShell.Navbar and AppShell.Footer overlap in iPad

2 participants