Skip to content
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

Fix overflow issue in ActionMenu #2383

Merged
merged 3 commits into from
Nov 20, 2023
Merged

Conversation

strackoverflow
Copy link
Member

@strackoverflow strackoverflow commented Nov 15, 2023

Authors: Please fill out this form carefully and completely.

Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.

Reviewers: This PR is best viewed with whitespace changes hidden.

What are you trying to accomplish?

This PR updates the ActionMenu component to use the Overlay component's body slot, which will allow the menu to properly scroll its overflown contents.

Thanks @langermank for help in solving this!

Screenshots

Before After
before after

List the issues that this change affects.

Closes #2380

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

Originally I intended to add customizable overflow options to ActionMenu, but @langermank helpfully pointed out that we can just make use of Overlay's body slot which would give us the proper overflow behavior 🎉

I couldn't think of a good way to write a test to cover overflow behavior in ActionMenu, I'm open to suggestions!

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@strackoverflow strackoverflow self-assigned this Nov 15, 2023
Copy link

changeset-bot bot commented Nov 15, 2023

🦋 Changeset detected

Latest commit: a8b8ae0

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

This PR includes changesets to release 1 package
Name Type
@primer/view-components 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

Copy link
Contributor

⚠️ Visual differences found

Our visual comparison tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review visual differences

@langermank
Copy link
Contributor

I couldn't think of a good way to write a test to cover overflow behavior in ActionMenu, I'm open to suggestions!

Only thing I can think of is to write a new preview with a max height set and the menu open. Then we can pickup a screenshot of it through snapshot testing. I think that could be a followup later though!

Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Member

@keithamus keithamus left a comment

Choose a reason for hiding this comment

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

Given this is a visual change it might be nice to add a snapshot to test the overflow bug.

Adding @snapshot interactive to an appropriate preview should be all you need.

Other than that this LGTM

Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏻

@strackoverflow strackoverflow merged commit 7c2e6f6 into main Nov 20, 2023
29 checks passed
@strackoverflow strackoverflow deleted the fix-action-menu-overflow branch November 20, 2023 19:32
@primer primer bot mentioned this pull request Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch release ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActionMenu items overflow when viewport is too short
4 participants