Skip to content

Modal: floating side modals, borders, safe areas, rubber band and iOS toolbar fill; softer dark elevation; iOS overflow scroll lock - #704

Merged
blvdmitry merged 11 commits into
mainfrom
claude/pensive-edison-2wqj9s
Nov 8, 2026
Merged

blvdmitry merged 11 commits into
mainfrom
claude/pensive-edison-2wqj9s

Conversation

@blvdmitry

@blvdmitry blvdmitry commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Modal

  • Side modals: start and end modals float --rs-unit-x2 away from the screen edges, or the safe-area inset when that's larger, and round all their corners.
    • The side far from the screen edge leaves --rs-unit-x6 for the overlay.
    • The closed transforms and the swipe closing distance include the edge offset.
    • Contained modals ignore safe areas.
  • Borders: all modals except full-screen get a 1px border-neutral-faded border. bottom only has it on the top side.
  • Bottom safe area padding: bottom modals add env(safe-area-inset-*) to their padding on the sides attached to the screen edges.
    • Modal now owns its padding through --rs-modal-p, the same pattern as Table, instead of the padding mixin.
    • Each position sets a single --rs-modal-safe switch (1 for bottom, 0 otherwise), so responsive positions reset it.
  • Rubber band: dragging past the open position is damped as -sqrt(distance), like Base UI's useSwipeDismiss, and springs back on release.
    • Content that can scroll in that direction still takes priority.
    • A gesture that picks up the modal mid-spring converts the damped offset back into drag distance.
    • The spring settles from rest, because the finger velocity doesn't match the damped movement.
  • iOS toolbar fill: while a non-contained bottom modal is active, Modal renders a position: fixed strip with the modal background at the bottom screen edge, behind the modal. It is the same approach as Base UI's drawer demo (mui/base-ui#4870). Safari 26 fills its floating toolbar area with the colour of fixed elements attached to the edge, and the strip also covers the bottom modal's rubber band overshoot.

Dark mode elevation colors

  • elevation-raised changes from oklch(0.22) to oklch(0.215), and elevation-overlay from oklch(0.24) to oklch(0.23). They are generated in @reshaped/theming; the slate theme and the generateColors snapshot are updated.

lockScroll

  • iOS sets overflow-x/y: hidden on the element that scrolls the page, the same approach as Base UI's useScrollLock, instead of fixing body. Fixing body made Safari 26 lose its translucent toolbars.
  • StyleCache now restores camelCase keys like paddingRight and scrollbarGutter. Before, they were saved as empty strings.

Related Issue

None

Screenshots / Recordings

Checked locally in Storybook in light and dark mode, LTR and RTL, with CDP touch events:

  • Side modals: start and end sit 8px from the edges with all corners rounded.
  • Padding: the padding stories render 0, 24 and 8/24px, the last being responsive. The bottom modal's padding grows by the emulated safe-area insets, overridden inline because Chromium has none.
  • Rubber band: dragging the end modal 200px past open moves it 14.1px and returns it on release. Dragging to close still closes it.
  • Borders: 1px on center and side modals, top-only on bottom, none on full-screen.
  • Toolbar fill strip: it renders only while a bottom modal is active and stays behind it.

Notes for Reviewers

  • full-screen doesn't add safe areas or a border.
  • Known trade-off, also documented by Base UI: iOS can still scroll the page behind the overlay with overflow: hidden when Safari's toolbar is collapsed.
  • Not tested on a real iOS device. Base UI reports iOS 26.0 not painting the toolbar area at all.
  • Theming and utilities unit tests pass. The utilities browser tests were run with the local Chromium because the pinned Playwright browser isn't installed here. The Storybook browser tests for reshaped didn't run for the same reason.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Library / JS 52.63 KB (+0.1% 🔺) 1.1 s (+0.1% 🔺) 0 ms (+100% 🔺) 1.1 s
Library / CSS 24.57 KB (+0.81% 🔺) 492 ms (+0.81% 🔺) 0 ms (+100% 🔺) 492 ms
Theming / JS 7.8 KB (+0.21% 🔺) 156 ms (+0.21% 🔺) 390 ms (+12.94% 🔺) 546 ms
Theming with a default theme definition / JS 8.68 KB (-0.13% 🔽) 174 ms (-0.13% 🔽) 421 ms (+42.94% 🔺) 595 ms

@blvdmitry blvdmitry changed the title Modal: float edge positions with safe area offsets and base elevation Modal: float edge positions with safe area offsets, base elevation and iOS overflow scroll lock Nov 8, 2026
@blvdmitry blvdmitry changed the title Modal: float edge positions with safe area offsets, base elevation and iOS overflow scroll lock Modal side corner radius, softer dark elevation colors and iOS overflow scroll lock Nov 8, 2026
@blvdmitry blvdmitry changed the title Modal side corner radius, softer dark elevation colors and iOS overflow scroll lock Modal side radius, safe area padding and rubber band; softer dark elevation; iOS overflow scroll lock Nov 8, 2026
@blvdmitry blvdmitry changed the title Modal side radius, safe area padding and rubber band; softer dark elevation; iOS overflow scroll lock Modal: floating side modals, borders, safe areas, rubber band and iOS toolbar fill; softer dark elevation; iOS overflow scroll lock Nov 8, 2026
claude added 10 commits November 8, 2026 22:19
Start, end and bottom modals now have an offset from the screen edges that
respects the browser safe area insets and rounded corners on all sides.
Corners facing the screen corners can be customized with
--rs-modal-edge-radius. Modal background now uses the base elevation,
except for modals with transparentOverlay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
Replace the body position: fixed lock on iOS with overflow: hidden on the
viewport scroller (html when it defines its own overflow, body otherwise),
matching the Base UI approach. Fixing the body collapsed the document height
and made Safari 26 lose its translucent toolbars while an overlay was open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
- Split safe area values into their own variables so the inset formulas are
  written once, RTL only swaps the safe areas and contained modals zero them
- Resolve the edge radius fallback once on the modal root
- Read the modal computed style once per touchstart
- StyleCache now reads original values through the style object, so
  camelCase keys like paddingRight and scrollbarGutter are restored on reset
- lockSafari checks the overflow longhands only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
…vation

- Restore the original start, end and bottom modal geometry and drop the
  safe area offsets, along with the related swipe distance change
- Round only the corners facing away from the screen edge for start and end
- Restore the overlay elevation background for modals
- Move dark mode raised and overlay elevation colors closer to base
  (0.22 -> 0.21, 0.24 -> 0.22) and regenerate the slate theme

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
- Add the safe area insets to the padding on the sides attached to the
  screen edges for bottom, start and end modals
- Damp dragging past the open position with a rubber band effect and keep
  the screen edge covered with a background bleed behind the modal
- Set dark elevation colors to raised 0.215 and overlay 0.23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
Render a fixed strip with the modal background at the bottom screen edge
behind non-contained bottom modals, the same approach as the Base UI drawer
demo, so iOS Safari fills its floating toolbar area with the modal color.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
- Bring back the edge offset for start and end modals, respecting the safe
  areas, with a larger offset on the side far from the screen edge
- Round all corners of start and end modals
- Remove the bleed shadow, floating side modals don't need it and the
  bottom edge strip covers the bottom modal overshoot
- Add a neutral faded border to all modals except full-screen, bottom
  only renders it on the top side

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
@blvdmitry
blvdmitry force-pushed the claude/pensive-edison-2wqj9s branch from 978e870 to 3edaa5d Compare November 8, 2026 22:19
- Own the padding with --rs-modal-p instead of the padding mixin, so the
  safe area is added without a higher specificity override, and switch the
  safe area per position with a single --rs-modal-safe variable
- Render the bottom edge strip only while the modal is active
- Drop the unused --rs-modal-drag fallback
- Pair dampOvershoot with undampOvershoot and read the modal computed style
  once per touchstart

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKGZMho9QKop2wXUJ4QUno
@blvdmitry
blvdmitry merged commit 8ff0310 into main Nov 8, 2026
11 checks passed
@blvdmitry
blvdmitry deleted the claude/pensive-edison-2wqj9s branch November 8, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants