Skip to content

Commit e51d209

Browse files
committed
Address feedback
1 parent e9ec49f commit e51d209

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/react-core/src/components/JumpLinks/JumpLinks.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,9 @@ export const JumpLinks: React.FunctionComponent<JumpLinksProps> = ({
244244
});
245245

246246
const id = getUniqueId();
247+
const hasAriaLabelledBy = expandable || (label && alwaysShowLabel);
248+
const computedAriaLabel = hasAriaLabelledBy ? null : ariaLabel;
249+
const computedAriaLabelledBy = hasAriaLabelledBy ? id : null;
247250

248251
return (
249252
<nav
@@ -255,9 +258,9 @@ export const JumpLinks: React.FunctionComponent<JumpLinksProps> = ({
255258
isExpanded && styles.modifiers.expanded,
256259
className
257260
)}
258-
aria-label={expandable || (label && alwaysShowLabel) ? null : ariaLabel}
261+
aria-label={computedAriaLabel}
259262
ref={navRef}
260-
aria-labelledby={expandable || (label && alwaysShowLabel) ? id : null}
263+
aria-labelledby={computedAriaLabelledBy}
261264
{...props}
262265
>
263266
<div className={styles.jumpLinksMain}>
@@ -287,8 +290,8 @@ export const JumpLinks: React.FunctionComponent<JumpLinksProps> = ({
287290
)}
288291
</div>
289292
<ul
290-
aria-label={expandable || (label && alwaysShowLabel) ? null : ariaLabel}
291-
aria-labelledby={expandable || (label && alwaysShowLabel) ? id : null}
293+
aria-label={computedAriaLabel}
294+
aria-labelledby={computedAriaLabelledBy}
292295
className={styles.jumpLinksList}
293296
role="list"
294297
>

0 commit comments

Comments
 (0)