Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e0f7136
chore: use Banner instead of custom implementation for SelectPanel no…
francinelucca Aug 26, 2025
8b65b06
Replace custom SelectPanel notice with Banner
francinelucca Aug 26, 2025
a70bf4e
test(vrt): update snapshots
francinelucca Aug 26, 2025
892e134
lint
francinelucca Aug 26, 2025
a084683
Merge branch '5647-bug-info-icon-misalignment-in-selectpanel-with-not…
francinelucca Aug 26, 2025
0a6f6a8
unskip test
francinelucca Aug 26, 2025
372ccb7
wrap banner in div to fix notice announcement
francinelucca Aug 26, 2025
087d5dc
fix css
francinelucca Aug 26, 2025
dbd317d
Merge branch 'main' into 5647-bug-info-icon-misalignment-in-selectpan…
francinelucca Aug 26, 2025
ccd42e1
test(vrt): update snapshots
francinelucca Aug 26, 2025
5641660
test(vrt): update snapshots
francinelucca Aug 27, 2025
f11af55
test(vrt): update snapshots
francinelucca Aug 27, 2025
a3c844b
Revert "test(vrt): update snapshots"
francinelucca Aug 27, 2025
c042be7
Revert "test(vrt): update snapshots"
francinelucca Aug 27, 2025
759d087
Revert "test(vrt): update snapshots"
francinelucca Aug 27, 2025
16e7252
Revert "test(vrt): update snapshots"
francinelucca Aug 27, 2025
5276008
Merge branch 'main' into 5647-bug-info-icon-misalignment-in-selectpan…
francinelucca Aug 27, 2025
ff6cc4a
test(vrt): update snapshots
francinelucca Aug 27, 2025
0f26bda
Merge branch 'main' into 5647-bug-info-icon-misalignment-in-selectpan…
francinelucca Aug 28, 2025
04edcea
Merge branch 'main' of github.com:primer/react into 5647-bug-info-ico…
francinelucca Sep 10, 2025
2ffa262
Banner: restrict custom icon to info/upsell to fix misaligned info icon
francinelucca Sep 10, 2025
37c0bad
Merge branch '5647-bug-info-icon-misalignment-in-selectpanel-with-not…
francinelucca Sep 10, 2025
103b838
test(vrt): update snapshots
francinelucca Sep 10, 2025
4289c99
test(vrt): update snapshots
francinelucca Sep 10, 2025
1255f0f
reset playwright
francinelucca Sep 10, 2025
f3f2511
test(vrt): update snapshots
francinelucca Sep 10, 2025
b41d482
test(vrt): update snapshots
francinelucca Sep 10, 2025
8971a92
Merge branch 'main' into 5647-bug-info-icon-misalignment-in-selectpan…
francinelucca Sep 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cuddly-cows-trade.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

chore: use Banner instead of custom implementation for SelectPanel notice
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion packages/react/src/Banner/Banner.docs.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,7 +100,12 @@
{
"name": "variant",
"type": "'critical' | 'info' | 'success' | 'upsell' | 'warning'",
"description": ""
"description": "Specify the type of the Banner"
},
{
"name": "layout",
"type": "'default' | 'compact'",
"description": "Specify the layout of the Banner. Compact layout will reduce the padding."
}
],
"subcomponents": [
Expand Down
4 changes: 4 additions & 0 deletions packages/react/src/Banner/Banner.module.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,6 +13,10 @@
container: banner / inline-size;
}

&[data-layout='compact'] {
padding: var(--base-size-4);
}

&[data-variant='critical'] {
--banner-bgColor: var(--bgColor-danger-muted);
--banner-borderColor: var(--borderColor-danger-muted);
Expand Down
6 changes: 6 additions & 0 deletions packages/react/src/Banner/Banner.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -64,6 +64,11 @@ export type BannerProps = React.ComponentPropsWithoutRef<'section'> & {
* Specify the type of the Banner
*/
variant?: BannerVariant

/**
* Specify the layout of the Banner. Compact layout will reduce the padding.
*/
layout?: 'default' | 'compact'
}

const iconForVariant: Record<BannerVariant, React.ReactNode> = {
Expand DownExpand Up@@ -140,6 +145,7 @@ export const Banner = React.forwardRef<HTMLElement, BannerProps>(function Banner
data-variant={variant}
tabIndex={-1}
ref={ref}
data-layout={rest.layout || 'default'}
>
<div className={classes.BannerIcon}>{icon && supportsCustomIcon ? icon : iconForVariant[variant]}</div>
<div className={classes.BannerContainer}>
Expand Down
12 changes: 1 addition & 11 deletions packages/react/src/SelectPanel/SelectPanel.module.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,19 +53,9 @@
}

.Notice {
display: flex;
padding-top: var(--base-size-12);
padding-right: var(--base-size-16);
padding-bottom: var(--base-size-12);
padding-left: var(--base-size-16);
margin-top: var(--base-size-4);
margin-right: var(--base-size-8);
margin-left: var(--base-size-8);
font-size: var(--text-body-size-small);
flex-direction: row;
border: var(--borderWidth-thin) solid;
gap: var(--base-size-8);
border-radius: var(--borderRadius-medium);
}

.Notice a {
Expand All@@ -85,7 +75,7 @@
border-color: var(--borderColor-attention-muted);
}

.Notice:where([data-variant='error']) {
.Notice:where([data-variant='critical']) {
color: var(--fgColor-danger);
background-color: var(--bgColor-danger-muted);
border-color: var(--borderColor-danger-muted);
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/SelectPanel/SelectPanel.test.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -695,7 +695,7 @@ for (const usingRemoveActiveDescendant of [false, true]) {
expect(screen.getByRole('combobox').hasAttribute('aria-describedby')).toBeTruthy()
})

it.skip('should announce initially focused item', async () => {
it('should announce initially focused item', async () => {
const user = userEvent.setup()
renderWithFlag(<FilterableSelectPanel />, usingRemoveActiveDescendant)

Expand Down
29 changes: 11 additions & 18 deletions packages/react/src/SelectPanel/SelectPanel.tsx
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
import {
AlertIcon,
InfoIcon,
SearchIcon,
StopIcon,
TriangleDownIcon,
XIcon,
type IconProps,
} from '@primer/octicons-react'
import {SearchIcon, TriangleDownIcon, XIcon, type IconProps} from '@primer/octicons-react'
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
import type {AnchoredOverlayProps} from '../AnchoredOverlay'
import {AnchoredOverlay} from '../AnchoredOverlay'
Expand DownExpand Up@@ -34,6 +26,7 @@ import {clsx} from 'clsx'
import {debounce} from '@github/mini-throttle'
import {useResponsiveValue} from '../hooks/useResponsiveValue'
import type {ButtonProps, LinkButtonProps} from '../Button/types'
import {Banner} from '../Banner'

// we add a delay so that it does not interrupt default screen reader announcement and queues after it
const SHORT_DELAY_MS = 500
Expand DownExpand Up@@ -675,12 +668,6 @@ function Panel({
}
}

const iconForNoticeVariant = {
info: <InfoIcon size={16} />,
warning: <AlertIcon size={16} />,
error: <StopIcon size={16} />,
}

function getMessage() {
if (items.length === 0 && !message) {
return DefaultEmptyMessage
Expand DownExpand Up@@ -826,9 +813,15 @@ function Panel({
) : null}
</div>
{notice && (
<div ref={noticeRef} data-variant={notice.variant} className={classes.Notice}>
{iconForNoticeVariant[notice.variant]}
<div>{notice.text}</div>
<div ref={noticeRef}>
<Banner
variant={notice.variant === 'error' ? 'critical' : notice.variant}
description={notice.text}
title="Notice"
hideTitle
className={classes.Notice}
layout="compact"
/>
</div>
)}
<FilteredActionList
Expand Down
Loading