Skip to content

Commit c1991ca

Browse files
committed
update infotip aria attributes
1 parent ea3238b commit c1991ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/gamut/src/Tip/InfoTip/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from 'react';
1+
import { useEffect, useId, useRef, useState } from 'react';
22

33
import { FloatingTip } from '../shared/FloatingTip';
44
import { InlineTip } from '../shared/InlineTip';
@@ -88,6 +88,8 @@ export const InfoTip: React.FC<InfoTipProps> = ({
8888

8989
const Tip = loaded && isFloating ? FloatingTip : InlineTip;
9090

91+
const textId = useId();
92+
9193
const tipProps = {
9294
alignment,
9395
escapeKeyPressHandler,
@@ -101,6 +103,7 @@ export const InfoTip: React.FC<InfoTipProps> = ({
101103
<ScreenreaderNavigableText
102104
aria-hidden={isAriaHidden}
103105
aria-live="assertive"
106+
id={textId}
104107
screenreader
105108
>
106109
{!isTipHidden ? info : `\xa0`}
@@ -109,6 +112,8 @@ export const InfoTip: React.FC<InfoTipProps> = ({
109112

110113
const tip = (
111114
<InfoTipButton
115+
aria-controls={textId}
116+
aria-expanded={!isTipHidden}
112117
active={!isTipHidden}
113118
emphasis={emphasis}
114119
onClick={() => clickHandler()}

0 commit comments

Comments
 (0)