-
Notifications
You must be signed in to change notification settings - Fork 661
fix(Banner): stack inline actions vertically on narrow viewports #7625
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
Changes from 2 commits
234434d
047bfd6
cc204e5
4754902
4d61ae7
1605626
c614cbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@primer/react': patch | ||
| --- | ||
|
|
||
| Banner: stack inline actions vertically on narrow viewports. |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,10 @@ | |||||||
|
|
||||||||
| & .BannerActions :where([data-primary-action='trailing']) { | ||||||||
| display: flex; | ||||||||
|
|
||||||||
| @media screen and (--viewportRange-narrow) { | ||||||||
| flex-direction: column-reverse; | ||||||||
|
||||||||
| flex-direction: column-reverse; | |
| flex-direction: column-reverse; | |
| row-gap: var(--base-size-2); |
Copilot
AI
Mar 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change fixes a narrow-viewport layout issue, but the existing Banner stories don’t currently cover actionsLayout="inline" at ~320px with both primary and secondary actions (the mobile example only shows a primary action). Adding/updating a Storybook case (and corresponding VRT/AVT coverage if applicable) for inline+two-actions at narrow widths would help prevent regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
flex-direction: column-reversewill make the visual order of the actions differ from DOM/focus order (Banner renderssecondaryActionbeforeprimaryActionin the trailing container). On narrow viewports this can cause keyboard focus to move bottom→top, which is an accessibility issue. Preferflex-direction: column(to keep visual order aligned with focus order), or otherwise change the rendered DOM order for this breakpoint so visual and focus order match.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested and this seems to be correct 👀 let's address it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch on keyboard focus
@copilot!I initially used
column-reverseto put the primary button on top, this is how it looks after switched tocolumnto keep visual order aligned with focus order:Curious what you think about this @lukasoppermann 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was actually that on small view ports the buttons are below:

Wonder why this is not working. Would it be possible to fix it like that? The text is very narrow if it is in two columns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue is specifically from the
actionsLayout="inline"story, which overrides the default responsive behavior. From the docs:When
actionsLayoutisinline, the container hasnowrapwhich prevents wrapping at all viewport sizes. Should we allowinlineto fall back to stacked at narrow viewports? or it should always stay inline?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed with @lukasoppermann that we will stack on narrow view port: