File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/ui-breadcrumb/src/Breadcrumb/BreadcrumbLink Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ class BreadcrumbLink extends Component<
6868 this . setState ( { isTruncated } )
6969 }
7070 }
71+
7172 render ( ) {
7273 const {
7374 children,
@@ -82,8 +83,15 @@ class BreadcrumbLink extends Component<
8283 const { isTruncated } = this . state
8384 const props = omitProps ( this . props , BreadcrumbLink . allowedProps )
8485
86+ const isInteractive = onClick || href
8587 return (
86- < Tooltip renderTip = { children } preventTooltip = { ! isTruncated } >
88+ < Tooltip
89+ renderTip = { children }
90+ preventTooltip = { ! isTruncated }
91+ // this wraps the achor/button tag in a span and puts the aria-describedby on that instead of the anchor/button tag
92+ // to avoid SRs reading the text twice when there is already an aria-label
93+ { ...( isInteractive && { as : 'span' } ) }
94+ >
8795 < Link
8896 { ...props }
8997 href = { href }
@@ -95,6 +103,10 @@ class BreadcrumbLink extends Component<
95103 elementRef = { this . handleRef }
96104 forceButtonRole = { false }
97105 { ...( isCurrentPage && { 'aria-current' : 'page' } ) }
106+ { ...( isTruncated && {
107+ ...( typeof children === 'string' && { 'aria-label' : children } ) ,
108+ ...( ! isInteractive && { role : 'text' } )
109+ } ) }
98110 >
99111 < TruncateText
100112 onUpdate = { ( isTruncated ) => this . handleTruncation ( isTruncated ) }
You can’t perform that action at this time.
0 commit comments