Skip to content

Conversation

@francinelucca
Copy link
Member

This pull request improves the handling of maximum height for overlays and action menus, ensuring they never exceed the viewport height and remain usable on smaller screens. It also introduces a new story example demonstrating scrollable overlay content when the maximum height is reached.

Changelog

New

  • Overlay story demonstrating max-height setting

Changed

  • Modify max-height css for ActionMenu and Overlay to be the minimum between the desired max-height and the height of the viewport, to ensure the content does not get clipped.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copilot AI review requested due to automatic review settings February 7, 2026 02:05
@francinelucca francinelucca requested a review from a team as a code owner February 7, 2026 02:05
@changeset-bot
Copy link

changeset-bot bot commented Feb 7, 2026

🦋 Changeset detected

Latest commit: c357d14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Feb 7, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

Ensure that the max-height of Overlay and ActionMenu does not exceed the viewport height.
@francinelucca francinelucca added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Feb 7, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates overlay-like components in @primer/react to ensure their max-height constraints don’t exceed the viewport, and adds a Storybook example demonstrating scrollable overlay content when a max-height is applied.

Changes:

  • Update Overlay and ActionMenu max-height size tokens to clamp against the viewport height.
  • Add a new Overlay features story demonstrating maxHeight + scrollable content.
  • Add story-only CSS for the new example’s layout.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

File Description
packages/react/src/Overlay/Overlay.module.css Clamp max-height size tokens against viewport height.
packages/react/src/ActionMenu/ActionMenu.module.css Clamp ActionMenu container max-height size tokens against viewport height.
packages/react/src/Overlay/Overlay.features.stories.tsx Add “SettingMaxHeight” Storybook example showcasing scrollable overlay content.
packages/react/src/Overlay/Overlay.features.stories.module.css Add styles for the new scrollable-content story layout.

@github-actions github-actions bot requested a deployment to storybook-preview-7510 February 7, 2026 02:09 Abandoned
@primer primer bot requested a review from a team as a code owner February 7, 2026 02:18
@github-actions github-actions bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Feb 7, 2026
@github-actions github-actions bot temporarily deployed to storybook-preview-7510 February 7, 2026 02:18 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-7510 February 7, 2026 02:28 Inactive
@francinelucca
Copy link
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Feb 10, 2026

@francinelucca I've opened a new pull request, #7519, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 9, 2026 23:04
…iewport handling (#7519)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: francinelucca <40550942+francinelucca@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 15 changed files in this pull request and generated 3 comments.

Comment on lines +611 to +613
const buttonRef = useRef<HTMLButtonElement>(null)
const confirmButtonRef = useRef<HTMLButtonElement>(null)
const closeOverlay = () => setIsOpen(false)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmButtonRef is used as the ref for the close IconButton (and as initialFocusRef), which makes the name misleading in this story. Rename it to something like closeButtonRef/initialFocusRef to match its role.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +609 to +613
export const SettingMaxHeight = () => {
const [isOpen, setIsOpen] = useState(false)
const buttonRef = useRef<HTMLButtonElement>(null)
const confirmButtonRef = useRef<HTMLButtonElement>(null)
const closeOverlay = () => setIsOpen(false)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SettingMaxHeight doesn’t accept Storybook args (notably open), so the e2e/VRT runner’s args: {open: true} won’t actually open the overlay for screenshots/a11y checks. Consider taking {open}: Args and rendering the overlay when isOpen || open (and align the useFocusTrap disabled condition accordingly).

Copilot uses AI. Check for mistakes.
@github-actions github-actions bot requested a deployment to storybook-preview-7510 February 10, 2026 04:09 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-7510 February 10, 2026 04:22 Inactive
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@francinelucca
Copy link
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Feb 10, 2026

@francinelucca I've opened a new pull request, #7522, to work on those changes. Once the pull request is ready, I'll request review from you.

@primer-integration
Copy link

👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/13256

@primer-integration
Copy link

Integration test results from github/github-ui:

Passed  CI   Passed
Running  VRT   Running
Passed  Projects   Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants