Skip to content

Commit bf85059

Browse files
committed
fix: Add new examples to tooltip simple page
1 parent 25f9734 commit bf85059

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pages/tooltip/simple.page.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export default function TooltipSimple() {
7676
nativeButtonAttributes={{
7777
onFocus: () => setShowInteractive(true),
7878
onBlur: () => setShowInteractive(false),
79+
'aria-describedby': `tooltip-position-${interactivePosition}`,
7980
}}
8081
data-testid="hover-button"
8182
>
@@ -109,6 +110,7 @@ export default function TooltipSimple() {
109110
nativeButtonAttributes={{
110111
onFocus: () => setShowTop(true),
111112
onBlur: () => setShowTop(false),
113+
'aria-describedby': 'tooltip-top',
112114
}}
113115
>
114116
Short
@@ -137,6 +139,7 @@ export default function TooltipSimple() {
137139
nativeButtonAttributes={{
138140
onFocus: () => setShowBottom(true),
139141
onBlur: () => setShowBottom(false),
142+
'aria-describedby': 'tooltip-bottom',
140143
}}
141144
>
142145
Medium
@@ -165,13 +168,14 @@ export default function TooltipSimple() {
165168
nativeButtonAttributes={{
166169
onFocus: () => setShowLeft(true),
167170
onBlur: () => setShowLeft(false),
171+
'aria-describedby': 'tooltip-left',
168172
}}
169173
>
170174
Long
171175
</Button>
172176
{showLeft && (
173177
<Tooltip
174-
content="This is a longer tooltip that contains more information and will likely wrap to multiple lines depending on the available space"
178+
content="This is a longer tooltip..."
175179
getTrack={() => leftRef.current}
176180
position="left"
177181
onEscape={() => setShowLeft(false)}
@@ -186,13 +190,14 @@ export default function TooltipSimple() {
186190
ref={rightRef}
187191
onMouseEnter={() => setShowRight(true)}
188192
onMouseLeave={() => setShowRight(false)}
193+
onFocus={() => setShowRight(true)}
194+
onBlur={() => setShowRight(false)}
189195
style={{ display: 'inline-block' }}
190196
>
191197
<Button
192198
variant="primary"
193199
nativeButtonAttributes={{
194-
onFocus: () => setShowRight(true),
195-
onBlur: () => setShowRight(false),
200+
'aria-describedby': 'tooltip-right',
196201
}}
197202
>
198203
Very Long
@@ -229,6 +234,7 @@ export default function TooltipSimple() {
229234
nativeButtonAttributes={{
230235
onFocus: () => setShowIconEdit(true),
231236
onBlur: () => setShowIconEdit(false),
237+
'aria-describedby': 'tooltip-icon-edit',
232238
}}
233239
/>
234240
{showIconEdit && (
@@ -254,6 +260,7 @@ export default function TooltipSimple() {
254260
nativeButtonAttributes={{
255261
onFocus: () => setShowIconDelete(true),
256262
onBlur: () => setShowIconDelete(false),
263+
'aria-describedby': 'tooltip-icon-delete',
257264
}}
258265
/>
259266
{showIconDelete && (
@@ -279,6 +286,7 @@ export default function TooltipSimple() {
279286
nativeButtonAttributes={{
280287
onFocus: () => setShowIconSettings(true),
281288
onBlur: () => setShowIconSettings(false),
289+
'aria-describedby': 'tooltip-icon-settings',
282290
}}
283291
/>
284292
{showIconSettings && (
@@ -305,6 +313,7 @@ export default function TooltipSimple() {
305313
onBlur={() => setShowDisabled(false)}
306314
tabIndex={0}
307315
style={{ display: 'inline-block' }}
316+
aria-describedby="tooltip-disabled"
308317
>
309318
<Button disabled={true} iconName="upload">
310319
Save
@@ -329,6 +338,7 @@ export default function TooltipSimple() {
329338
onMouseEnter={() => setShowTruncated(true)}
330339
onMouseLeave={() => setShowTruncated(false)}
331340
style={{ maxWidth: '200px' }}
341+
aria-describedby="tooltip-truncated"
332342
>
333343
<div
334344
style={{
@@ -371,6 +381,7 @@ export default function TooltipSimple() {
371381
onBlur={() => setShowLink(false)}
372382
style={{ color: '#0073bb', textDecoration: 'underline', cursor: 'pointer' }}
373383
onClick={e => e.preventDefault()}
384+
aria-describedby="tooltip-link-tooltip"
374385
>
375386
Documentation Link
376387
</a>
@@ -401,6 +412,7 @@ export default function TooltipSimple() {
401412
onBlur={() => setShowCode(false)}
402413
tabIndex={0}
403414
style={{ display: 'inline-block' }}
415+
aria-describedby="tooltip-code-tooltip"
404416
>
405417
<span
406418
style={{
@@ -463,6 +475,7 @@ export default function TooltipSimple() {
463475
}}
464476
onFocus={() => setShowPassword(true)}
465477
onBlur={() => setShowPassword(false)}
478+
aria-describedby="tooltip-password-rules"
466479
/>
467480
{showPassword && (
468481
<Tooltip

0 commit comments

Comments
 (0)