-
- {title ? (
- hideTitle ? (
-
+
+
+ {icon && supportsCustomIcon ? icon : iconForVariant[variant]}
+
+
+ {title ? (
+ hideTitle ? (
+
+ {title}
+
+ ) : (
{title}
-
- ) : (
- {title}
- )
- ) : null}
- {description ? {description} : null}
- {children}
+ )
+ ) : null}
+ {description ? {description} : null}
+ {children}
+
+ {hasActions ?
: null}
- {hasActions ? : null}
-
- {dismissible ? (
-
- ) : null}
-
+ {dismissible ? (
+
+ ) : null}
+
+
)
})
@@ -192,9 +194,12 @@ export type BannerTitleProps
= {
} & React.ComponentPropsWithoutRef
export function BannerTitle(props: BannerTitleProps) {
- const {as: Heading = 'h2', className, children, ...rest} = props
+ const {as: Heading = 'h2', className, children, id, ...rest} = props
+ const context = React.useContext(BannerContext)
+ const titleId = id ?? context?.titleId
+
return (
-
+
{children}
)
From 9849b61e85ccf900e54b0c40fd2cbb86ef64eec6 Mon Sep 17 00:00:00 2001
From: Liu Liu
Date: Wed, 28 Jan 2026 13:52:07 -0800
Subject: [PATCH 3/3] changeset
---
.changeset/banner-aria-labelledby-title.md | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 .changeset/banner-aria-labelledby-title.md
diff --git a/.changeset/banner-aria-labelledby-title.md b/.changeset/banner-aria-labelledby-title.md
new file mode 100644
index 00000000000..c10c0756daa
--- /dev/null
+++ b/.changeset/banner-aria-labelledby-title.md
@@ -0,0 +1,5 @@
+---
+'@primer/react': minor
+---
+
+Banner: Use `aria-labelledby` to reference the title for the landmark region instead of generic variant labels.