Skip to content

Commit b02fc34

Browse files
fix: Update button titles to aria-labels for improved accessibility in BpkNudger (#4228)
Co-authored-by: Tom Brown <tom.brown@skyscanner.net>
1 parent a4a40c5 commit b02fc34

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

packages/bpk-component-nudger/src/BpkNudger.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const BpkNudger = ({
122122
inputRef.current && setNativeValue(inputRef.current, newValue);
123123
}}
124124
disabled={minButtonDisabled}
125-
title={decreaseButtonLabel}
125+
aria-label={decreaseButtonLabel}
126126
aria-controls={id}
127127
>
128128
<AlignedMinusIcon />
@@ -166,7 +166,7 @@ const BpkNudger = ({
166166
inputRef.current && setNativeValue(inputRef.current, newValue);
167167
}}
168168
disabled={maxButtonDisabled}
169-
title={increaseButtonLabel}
169+
aria-label={increaseButtonLabel}
170170
aria-controls={id}
171171
>
172172
<AlignedPlusIcon />

packages/bpk-component-nudger/src/__snapshots__/BpkNudger-test.tsx.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ exports[`BpkNudger should render as an on dark nudger correctly 1`] = `
1010
>
1111
<button
1212
aria-controls="nudger"
13+
aria-label="Decrease"
1314
class="bpk-button bpk-button--icon-only bpk-button--secondary-on-dark"
1415
data-backpack-ds-component="Button"
15-
title="Decrease"
1616
type="button"
1717
>
1818
<span
@@ -43,9 +43,9 @@ exports[`BpkNudger should render as an on dark nudger correctly 1`] = `
4343
/>
4444
<button
4545
aria-controls="nudger"
46+
aria-label="Increase"
4647
class="bpk-button bpk-button--icon-only bpk-button--secondary-on-dark"
4748
data-backpack-ds-component="Button"
48-
title="Increase"
4949
type="button"
5050
>
5151
<span
@@ -79,9 +79,9 @@ exports[`BpkNudger should render correctly 1`] = `
7979
>
8080
<button
8181
aria-controls="nudger"
82+
aria-label="Decrease"
8283
class="bpk-button bpk-button--icon-only bpk-button--secondary"
8384
data-backpack-ds-component="Button"
84-
title="Decrease"
8585
type="button"
8686
>
8787
<span
@@ -112,9 +112,9 @@ exports[`BpkNudger should render correctly 1`] = `
112112
/>
113113
<button
114114
aria-controls="nudger"
115+
aria-label="Increase"
115116
class="bpk-button bpk-button--icon-only bpk-button--secondary"
116117
data-backpack-ds-component="Button"
117-
title="Increase"
118118
type="button"
119119
>
120120
<span
@@ -148,10 +148,10 @@ exports[`BpkNudger should render correctly with a value < min 1`] = `
148148
>
149149
<button
150150
aria-controls="nudger"
151+
aria-label="Decrease"
151152
class="bpk-button bpk-button--icon-only bpk-button--secondary"
152153
data-backpack-ds-component="Button"
153154
disabled=""
154-
title="Decrease"
155155
type="button"
156156
>
157157
<span
@@ -182,9 +182,9 @@ exports[`BpkNudger should render correctly with a value < min 1`] = `
182182
/>
183183
<button
184184
aria-controls="nudger"
185+
aria-label="Increase"
185186
class="bpk-button bpk-button--icon-only bpk-button--secondary"
186187
data-backpack-ds-component="Button"
187-
title="Increase"
188188
type="button"
189189
>
190190
<span
@@ -218,9 +218,9 @@ exports[`BpkNudger should render correctly with a value = max 1`] = `
218218
>
219219
<button
220220
aria-controls="nudger"
221+
aria-label="Decrease"
221222
class="bpk-button bpk-button--icon-only bpk-button--secondary"
222223
data-backpack-ds-component="Button"
223-
title="Decrease"
224224
type="button"
225225
>
226226
<span
@@ -251,10 +251,10 @@ exports[`BpkNudger should render correctly with a value = max 1`] = `
251251
/>
252252
<button
253253
aria-controls="nudger"
254+
aria-label="Increase"
254255
class="bpk-button bpk-button--icon-only bpk-button--secondary"
255256
data-backpack-ds-component="Button"
256257
disabled=""
257-
title="Increase"
258258
type="button"
259259
>
260260
<span
@@ -288,10 +288,10 @@ exports[`BpkNudger should render correctly with a value = min 1`] = `
288288
>
289289
<button
290290
aria-controls="nudger"
291+
aria-label="Decrease"
291292
class="bpk-button bpk-button--icon-only bpk-button--secondary"
292293
data-backpack-ds-component="Button"
293294
disabled=""
294-
title="Decrease"
295295
type="button"
296296
>
297297
<span
@@ -322,9 +322,9 @@ exports[`BpkNudger should render correctly with a value = min 1`] = `
322322
/>
323323
<button
324324
aria-controls="nudger"
325+
aria-label="Increase"
325326
class="bpk-button bpk-button--icon-only bpk-button--secondary"
326327
data-backpack-ds-component="Button"
327-
title="Increase"
328328
type="button"
329329
>
330330
<span
@@ -358,9 +358,9 @@ exports[`BpkNudger should render correctly with a value > max 1`] = `
358358
>
359359
<button
360360
aria-controls="nudger"
361+
aria-label="Decrease"
361362
class="bpk-button bpk-button--icon-only bpk-button--secondary"
362363
data-backpack-ds-component="Button"
363-
title="Decrease"
364364
type="button"
365365
>
366366
<span
@@ -391,10 +391,10 @@ exports[`BpkNudger should render correctly with a value > max 1`] = `
391391
/>
392392
<button
393393
aria-controls="nudger"
394+
aria-label="Increase"
394395
class="bpk-button bpk-button--icon-only bpk-button--secondary"
395396
data-backpack-ds-component="Button"
396397
disabled=""
397-
title="Increase"
398398
type="button"
399399
>
400400
<span

0 commit comments

Comments
 (0)