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

Make Dialog footer scrollable on very short viewports #5629

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hectahertz
Copy link
Contributor

Part of the work to improve reflow of the component. This helps to make all the footer buttons accessible on small screens and gives some extra breathing room to the body.

Changelog

Changed

Dialog footer becomes scrollable on very short viewports.

Before

Screen.Recording.2025-01-30.at.20.46.28.mov

After

Screen.Recording.2025-01-30.at.20.46.08.mov

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

The CSS changes seem a bit esoteric, but are due to overflow: scroll not being compatible with justify-content: flex-end. flex-direction: row-reverse; flex-wrap: wrap-reverse; plus reversing the items is visually equivalent but compatible. The focus order keeps being the same.

Merge checklist

@hectahertz hectahertz requested a review from a team as a code owner January 30, 2025 19:52
@hectahertz hectahertz requested a review from joshblack January 30, 2025 19:52
Copy link

changeset-bot bot commented Jan 30, 2025

🦋 Changeset detected

Latest commit: 40ea8f7

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

Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jan 30, 2025
Copy link
Contributor

github-actions bot commented Jan 30, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 105.63 KB (+0.06% 🔺)
packages/react/dist/browser.umd.js 106.06 KB (+0.02% 🔺)

@primer primer bot requested a review from a team as a code owner February 7, 2025 22:02
@primer primer bot requested a review from emilybrick February 7, 2025 22:02
@primer primer bot temporarily deployed to github-pages February 7, 2025 22:15 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-5629 February 7, 2025 22:15 Inactive
Comment on lines +249 to +250
flex-direction: row-reverse;
flex-wrap: wrap-reverse;
Copy link
Member

Choose a reason for hiding this comment

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

I noticed the buttons were reversed, and focus seems to be too. Wasn't sure if this was expected or not 🤔

Copy link
Contributor Author

@hectahertz hectahertz Feb 12, 2025

Choose a reason for hiding this comment

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

They shouldn't be! This is compensated for in the JS code. Let's review this together

Copy link
Member

Choose a reason for hiding this comment

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

I think the buttons are only reversed on the ConfirmationDialog. If we reverse the array for the footer buttons in that component then I think the issue should be fixed 🤔

Copy link
Member

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

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

Left a few more comments, curious on what you think! Looks almost good to go 🚀

gap: ${get('space.2')};
z-index: 1;
flex-shrink: 0;

@media (max-height: 256px) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if we might want to increase this a bit, maybe by 50-100px? I noticed that on some screen sizes, the body isn't visible. I think increasing it a bit would fix it.

The only potential issue is if a consumer adds even more buttons, which could mean that even an increase of the max-height wouldn't help. I don't think this is an issue the component should solve, as we wouldn't want consumers adding dozens of buttons in a footer 😅

Comment on lines +629 to +638
flex-direction: row-reverse;
flex-wrap: wrap-reverse;
gap: ${get('space.2')};
z-index: 1;
flex-shrink: 0;

@media (max-height: 256px) {
flex-wrap: nowrap;
overflow-x: scroll;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flex-direction: row-reverse;
flex-wrap: wrap-reverse;
gap: ${get('space.2')};
z-index: 1;
flex-shrink: 0;
@media (max-height: 256px) {
flex-wrap: nowrap;
overflow-x: scroll;
}
flex-flow: wrap;
justify-content: flex-end;
gap: ${get('space.2')};
z-index: 1;
flex-shrink: 0;
@media (max-height: 356px) {
flex-wrap: nowrap;
overflow-x: scroll;
flex-direction: row;
justify-content: unset;
}

Curious what you think about this change? I think this also means we don't have to utilize reverse() on the footer buttons.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants