Skip to content

Add scroll fade indicators to Modal content area.#1811

Open
bendansby wants to merge 1 commit into
NoRedInk:masterfrom
bendansby:modal-scroll-fade
Open

Add scroll fade indicators to Modal content area.#1811
bendansby wants to merge 1 commit into
NoRedInk:masterfrom
bendansby:modal-scroll-fade

Conversation

@bendansby
Copy link
Copy Markdown
Contributor

@bendansby bendansby commented Apr 27, 2026

Context

When the Modal's content overflows the visible area, there was no visual indication that more content existed beyond the top or bottom edge. This adds a soft fade above/below the scrollable region that appears only when there's content scrolled out of view in that direction.

🔧 What changes

  • Adds the classic Lea Verou scroll-shadow four-gradient pattern to the Modal content area:
    • Two background-attachment: local white "covers" at top and bottom that scroll with the content. They sit over the static shadows when you're at the edge, hiding them.
    • Two background-attachment: scroll dark gradients that stay fixed to the viewport. As soon as content scrolls past an edge, the cover moves out of the way and the shadow is revealed.
  • White covers are 48px tall and reach full opacity at 50% of their height, so they fully hide the 32px dark shadow when at an edge (no faint shadow bleeding through).
  • Listed in the V12 patch changelog.

Component completion checklist

  • Changes are clearly documented (V12 changelog updated)
  • No API change — purely a CSS addition
  • No new major version (patch-level change to V12)
  • Component Catalog example unchanged — the existing Modal example with long content already exercises this
  • Reviewers
    • Component library owner
    • Designer (since this is a user-visible change)

Notes for reviewers

  • Pure CSS, no JS / scroll listeners — uses background-attachment: local vs scroll to detect overflow direction.
  • Works on all modern browsers (FF, Safari, Chrome, Edge).
  • The fade is visible against the white modal background — this assumes the content area stays white, which is currently always the case.

Use the four-layer scroll-shadow background trick (two local-attached
white covers at top and bottom that scroll with the content, plus two
fixed dark gradients) so a soft fade is visible above and below the
scrollable region only when there is content out of view in that
direction.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@bendansby bendansby requested a review from bcardiff May 11, 2026 17:17
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.

1 participant