Skip to content

Commit a2e7c44

Browse files
committed
Tooltip: add aria-describedby to anchor only if not redundant
1 parent 6aad856 commit a2e7c44

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/components/src/tooltip/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ function UnforwardedTooltip(
109109
// the tooltip anchor anymore since 0.4.0, so we need to add it manually.
110110
// See: https://github.com/WordPress/gutenberg/pull/64066
111111
function addDescribedById( element: React.ReactElement ) {
112-
return describedById && mounted
112+
return describedById &&
113+
mounted &&
114+
element.props[ 'aria-describedby' ] === undefined &&
115+
element.props[ 'aria-label' ] !== text
113116
? cloneElement( element, { 'aria-describedby': describedById } )
114117
: element;
115118
}

0 commit comments

Comments
 (0)