Skip to content

fix(modal): adjust scroll to account for gradient #19534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

warrenmblood
Copy link
Contributor

@warrenmblood warrenmblood commented May 30, 2025

Closes #19277

On a blur event when Modal has scrollable content, adjust scroll if needed to prevent element in focus from being obscured by the gradient styling.

Made changes to the following components:

  • React:
    ComposedModal
    Modal

  • Web Component
    Modal

Changelog

New

  • In onBlur handler, calculate spacing needed and update scrollTop of Modal content

Testing / Reviewing

  • CI tests should pass
  • Go to Storybook and check that gradient styling does not obscure the focused element while navigating only using TAB through the scrollable Modal. Check the following:
    React:
    Modal w/ AI Label
    ComposedModal w/ AI Label
    ComposedModal w/ Scrolling Content
    Web Component:
    Modal w/ AI Label

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@warrenmblood warrenmblood requested review from a team as code owners May 30, 2025 21:01
Copy link

netlify bot commented May 30, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit ce1d35f
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/683a1cc44f64eb0008c70bfe
😎 Deploy Preview https://deploy-preview-19534--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

netlify bot commented May 30, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ce1d35f
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/683a1cc40df17f0008d19a42
😎 Deploy Preview https://deploy-preview-19534--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 47.36842% with 20 lines in your changes missing coverage. Please review.

Project coverage is 84.47%. Comparing base (4c395af) to head (ce1d35f).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...act/src/components/ComposedModal/ComposedModal.tsx 54.54% 10 Missing ⚠️
packages/react/src/components/Modal/Modal.tsx 37.50% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19534      +/-   ##
==========================================
- Coverage   84.56%   84.47%   -0.10%     
==========================================
  Files         373      373              
  Lines       14662    14695      +33     
  Branches     4848     4816      -32     
==========================================
+ Hits        12399    12413      +14     
- Misses       2116     2135      +19     
  Partials      147      147              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kennylam kennylam added this pull request to the merge queue Jun 2, 2025
Merged via the queue into carbon-design-system:main with commit cbd34d3 Jun 2, 2025
37 checks passed
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.

[a11y]: ComposedModal with scrolling content doesn't bring element into viewport with focus
4 participants