@@ -62,10 +62,15 @@ export const HeightInitialWithOverflowingItemsStory = () => {
62
62
63
63
return (
64
64
< FormControl >
65
- < FormControl . Label > Labels</ FormControl . Label >
65
+ < FormControl . Label id = "height-overflow-label" > Labels</ FormControl . Label >
66
66
< SelectPanel
67
+ id = "height-overflow"
67
68
renderAnchor = { ( { children, ...anchorProps } ) => (
68
- < Button trailingAction = { TriangleDownIcon } { ...anchorProps } >
69
+ < Button
70
+ aria-labelledby = "height-overflow height-overflow-label"
71
+ trailingAction = { TriangleDownIcon }
72
+ { ...anchorProps }
73
+ >
69
74
{ children }
70
75
</ Button >
71
76
) }
@@ -94,10 +99,15 @@ export const HeightInitialWithUnderflowingItemsStory = () => {
94
99
95
100
return (
96
101
< FormControl >
97
- < FormControl . Label > Labels</ FormControl . Label >
102
+ < FormControl . Label id = "height-underflow-label" > Labels</ FormControl . Label >
98
103
< SelectPanel
104
+ id = "height-underflow"
99
105
renderAnchor = { ( { children, ...anchorProps } ) => (
100
- < Button trailingAction = { TriangleDownIcon } { ...anchorProps } >
106
+ < Button
107
+ aria-labelledby = "height-underflow height-underflow-label"
108
+ trailingAction = { TriangleDownIcon }
109
+ { ...anchorProps }
110
+ >
101
111
{ children }
102
112
</ Button >
103
113
) }
@@ -139,10 +149,15 @@ export const HeightInitialWithUnderflowingItemsAfterFetch = () => {
139
149
140
150
return (
141
151
< FormControl >
142
- < FormControl . Label > Labels</ FormControl . Label >
152
+ < FormControl . Label id = "height-after-fetch-label" > Labels</ FormControl . Label >
143
153
< SelectPanel
154
+ id = "height-after-fetch"
144
155
renderAnchor = { ( { children, 'aria-labelledby' : ariaLabelledBy , ...anchorProps } ) => (
145
- < Button trailingAction = { TriangleDownIcon } aria-labelledby = { ` ${ ariaLabelledBy } ` } { ...anchorProps } >
156
+ < Button
157
+ trailingAction = { TriangleDownIcon }
158
+ aria-labelledby = { `height-after-fetch height-after-fetch-label ${ ariaLabelledBy || '' } ` }
159
+ { ...anchorProps }
160
+ >
146
161
{ children }
147
162
</ Button >
148
163
) }
@@ -171,10 +186,15 @@ export const AboveTallBody = () => {
171
186
const [ open , setOpen ] = useState ( false )
172
187
return (
173
188
< FormControl >
174
- < FormControl . Label > Labels</ FormControl . Label >
189
+ < FormControl . Label id = "above-tall-body-label" > Labels</ FormControl . Label >
175
190
< SelectPanel
191
+ id = "above-tall-body"
176
192
renderAnchor = { ( { children, 'aria-labelledby' : ariaLabelledBy , ...anchorProps } ) => (
177
- < Button trailingAction = { TriangleDownIcon } aria-labelledby = { ` ${ ariaLabelledBy } ` } { ...anchorProps } >
193
+ < Button
194
+ trailingAction = { TriangleDownIcon }
195
+ aria-labelledby = { `above-tall-body above-tall-body-label ${ ariaLabelledBy || '' } ` }
196
+ { ...anchorProps }
197
+ >
178
198
{ children }
179
199
</ Button >
180
200
) }
@@ -222,10 +242,15 @@ export const HeightVariationsAndScroll = () => {
222
242
return (
223
243
< >
224
244
< FormControl >
225
- < FormControl . Label > With height:medium</ FormControl . Label >
245
+ < FormControl . Label id = "height-variation-medium-label" > With height:medium</ FormControl . Label >
226
246
< SelectPanel
247
+ id = "height-variation-medium"
227
248
renderAnchor = { ( { children, ...anchorProps } ) => (
228
- < Button trailingAction = { TriangleDownIcon } { ...anchorProps } >
249
+ < Button
250
+ aria-labelledby = "height-variation-medium-label height-variation-medium"
251
+ trailingAction = { TriangleDownIcon }
252
+ { ...anchorProps }
253
+ >
229
254
{ children ?? 'Select Labels' }
230
255
</ Button >
231
256
) }
@@ -243,10 +268,15 @@ export const HeightVariationsAndScroll = () => {
243
268
</ FormControl >
244
269
< br />
245
270
< FormControl >
246
- < FormControl . Label > With height:auto, maxheight:medium</ FormControl . Label >
271
+ < FormControl . Label id = "height-variation-maxheight-label" > With height:auto, maxheight:medium</ FormControl . Label >
247
272
< SelectPanel
273
+ id = "height-variation-maxheight"
248
274
renderAnchor = { ( { children, ...anchorProps } ) => (
249
- < Button trailingAction = { TriangleDownIcon } { ...anchorProps } >
275
+ < Button
276
+ aria-labelledby = "height-variation-maxheight-label height-variation-maxheight"
277
+ trailingAction = { TriangleDownIcon }
278
+ { ...anchorProps }
279
+ >
250
280
{ children ?? 'Select Labels' }
251
281
</ Button >
252
282
) }
@@ -284,11 +314,19 @@ export const CustomItemRenderer = () => {
284
314
285
315
return (
286
316
< FormControl >
287
- < FormControl . Label > Long string with truncation (not reviewed for accessibility)</ FormControl . Label >
317
+ < FormControl . Label id = "custom-item-renderer-label" >
318
+ Long string with truncation (not reviewed for accessibility)
319
+ </ FormControl . Label >
288
320
< SelectPanel
321
+ id = "custom-item-renderer"
289
322
title = "Select files"
290
323
renderAnchor = { anchorProps => (
291
- < Button trailingAction = { TriangleDownIcon } { ...anchorProps } aria-haspopup = "dialog" >
324
+ < Button
325
+ aria-labelledby = "custom-item-renderer-label"
326
+ trailingAction = { TriangleDownIcon }
327
+ { ...anchorProps }
328
+ aria-haspopup = "dialog"
329
+ >
292
330
Select files
293
331
</ Button >
294
332
) }
@@ -351,9 +389,19 @@ export const ItemsInScope = () => {
351
389
const [ open , setOpen ] = useState ( false )
352
390
return (
353
391
< FormControl >
354
- < FormControl . Label > Items in component scope</ FormControl . Label >
392
+ < FormControl . Label id = "component-scope-label" > Items in component scope</ FormControl . Label >
355
393
< SelectPanel
394
+ id = "component-scope"
356
395
title = "Select labels"
396
+ renderAnchor = { ( { children, ...anchorProps } ) => (
397
+ < Button
398
+ aria-labelledby = "component-scope component-scope-label"
399
+ trailingAction = { TriangleDownIcon }
400
+ { ...anchorProps }
401
+ >
402
+ { children }
403
+ </ Button >
404
+ ) }
357
405
placeholder = "Select labels" // button text when no items are selected
358
406
open = { open }
359
407
onOpenChange = { setOpen }
0 commit comments