Skip to content

Commit f5aeb83

Browse files
authored
fix(tablist): make aria-label optional (#18323)
* fix(tabs): make tablist aria-label optional * docs(tabs): update stories to not include tablist aria-label
1 parent ee635af commit f5aeb83

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7837,7 +7837,6 @@ Map {
78377837
"type": "oneOf",
78387838
},
78397839
"aria-label": Object {
7840-
"isRequired": true,
78417840
"type": "string",
78427841
},
78437842
"children": Object {

packages/react/src/components/Tabs/Tabs.stories.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default {
6767
export const Default = (args) => {
6868
return (
6969
<Tabs onTabCloseRequest={() => {}}>
70-
<TabList aria-label="List of tabs" {...args}>
70+
<TabList {...args}>
7171
<Tab>Dashboard</Tab>
7272
<Tab>Monitoring</Tab>
7373
<Tab>Activity</Tab>
@@ -186,7 +186,7 @@ export const Dismissable = () => {
186186
onChange={handleTabChange}
187187
dismissable
188188
onTabCloseRequest={handleCloseTabRequest}>
189-
<TabList aria-label="List of tabs">
189+
<TabList>
190190
{renderedTabs.map((tab, index) => (
191191
<Tab key={index} disabled={tab.disabled}>
192192
{tab.label}
@@ -259,7 +259,7 @@ export const DismissableWithIcons = ({ contained }) => {
259259
onChange={handleTabChange}
260260
dismissable
261261
onTabCloseRequest={handleCloseTabRequest}>
262-
<TabList aria-label="List of tabs" contained={contained}>
262+
<TabList contained={contained}>
263263
{renderedTabs.map((tab, index) => (
264264
<Tab key={index} disabled={tab.disabled} renderIcon={icons[index]}>
265265
{tab.label}
@@ -275,7 +275,7 @@ export const DismissableWithIcons = ({ contained }) => {
275275
export const WithIcons = () => {
276276
return (
277277
<Tabs>
278-
<TabList activation="manual" aria-label="List of tabs">
278+
<TabList activation="manual">
279279
<Tab renderIcon={Dashboard}>Dashboard</Tab>
280280
<Tab renderIcon={CloudMonitoring}>Monitoring</Tab>
281281
<Tab renderIcon={Activity}>Activity</Tab>
@@ -314,7 +314,7 @@ export const WithIcons = () => {
314314
export const Manual = () => {
315315
return (
316316
<Tabs>
317-
<TabList activation="manual" aria-label="List of tabs">
317+
<TabList activation="manual">
318318
<Tab>Dashboard</Tab>
319319
<Tab>Monitoring</Tab>
320320
<Tab title="Tab label 4">Activity</Tab>
@@ -351,7 +351,7 @@ export const Manual = () => {
351351
export const Icon20Only = () => {
352352
return (
353353
<Tabs>
354-
<TabList iconSize="lg" aria-label="List of tabs">
354+
<TabList iconSize="lg">
355355
<IconTab label="Analyze" disabled>
356356
<IbmWatsonDiscovery size={20} aria-label="Analyze" />
357357
</IconTab>
@@ -378,7 +378,7 @@ export const Icon20Only = () => {
378378
export const IconOnly = () => {
379379
return (
380380
<Tabs>
381-
<TabList aria-label="List of tabs">
381+
<TabList>
382382
<IconTab label="Analyze" disabled>
383383
<IbmWatsonDiscovery aria-label="Analyze" />
384384
</IconTab>
@@ -405,7 +405,7 @@ export const IconOnly = () => {
405405
export const Contained = () => {
406406
return (
407407
<Tabs>
408-
<TabList aria-label="List of tabs" contained>
408+
<TabList contained>
409409
<Tab>Dashboard</Tab>
410410
<Tab>Monitoring</Tab>
411411
<Tab>Activity</Tab>
@@ -443,7 +443,7 @@ export const Contained = () => {
443443
export const ContainedWithIcons = () => {
444444
return (
445445
<Tabs>
446-
<TabList aria-label="List of tabs" contained>
446+
<TabList contained>
447447
<Tab renderIcon={Dashboard}>Dashboard</Tab>
448448
<Tab renderIcon={CloudMonitoring}>Monitoring</Tab>
449449
<Tab renderIcon={Activity}>Activity</Tab>
@@ -483,7 +483,7 @@ export const ContainedWithIcons = () => {
483483
export const ContainedWithSecondaryLabels = () => {
484484
return (
485485
<Tabs>
486-
<TabList aria-label="List of tabs" contained>
486+
<TabList contained>
487487
<Tab secondaryLabel="(21/25)">Engage</Tab>
488488
<Tab secondaryLabel="(12/16)">Analyze</Tab>
489489
<Tab secondaryLabel="(0/7)">Remediate</Tab>
@@ -523,7 +523,7 @@ export const ContainedWithSecondaryLabels = () => {
523523
export const ContainedWithSecondaryLabelsAndIcons = () => {
524524
return (
525525
<Tabs>
526-
<TabList aria-label="List of tabs" contained>
526+
<TabList contained>
527527
<Tab renderIcon={Task} secondaryLabel="(21/25">
528528
Engage
529529
</Tab>
@@ -573,7 +573,7 @@ export const ContainedFullWidth = () => {
573573
<Grid condensed>
574574
<Column lg={16} md={8} sm={4}>
575575
<Tabs>
576-
<TabList aria-label="List of tabs" contained fullWidth>
576+
<TabList contained fullWidth>
577577
<Tab>TLS</Tab>
578578
<Tab>Origin</Tab>
579579
<Tab disabled>Rate limiting</Tab>
@@ -619,7 +619,7 @@ export const ContainedFullWidth = () => {
619619
export const Vertical = (args) => {
620620
return (
621621
<TabsVertical {...args}>
622-
<TabListVertical aria-label="List of tabs">
622+
<TabListVertical>
623623
<Tab>Dashboard</Tab>
624624
<Tab>
625625
Extra long label that will go two lines then truncate when it goes

packages/react/src/components/Tabs/Tabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ export interface TabListProps extends DivAttributes {
367367
* Provide an accessible label to be read when a user interacts with this
368368
* component
369369
*/
370-
'aria-label': string;
370+
'aria-label'?: string;
371371

372372
/**
373373
* Provide child elements to be rendered inside `ContentTabs`.
@@ -778,7 +778,7 @@ TabList.propTypes = {
778778
* Provide an accessible label to be read when a user interacts with this
779779
* component
780780
*/
781-
'aria-label': PropTypes.string.isRequired,
781+
'aria-label': PropTypes.string,
782782

783783
/**
784784
* Provide child elements to be rendered inside `ContentTabs`.

0 commit comments

Comments
 (0)