mirror of
https://github.com/zhigang1992/react.git
synced 2026-01-31 22:41:29 +08:00
Merge pull request #308 from yqrashawn/tab-role
fix(tabs): add role="button" to tab for a11y
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Tabs should render correctly 1`] = `
|
||||
"<div class=\\"tabs \\"><header class=\\"\\"><div class=\\"tab \\">label1</div><div class=\\"tab \\">label2</div></header><div class=\\"content\\"></div><style>
|
||||
"<div class=\\"tabs \\"><header class=\\"\\"><div class=\\"tab \\" role=\\"button\\">label1</div><div class=\\"tab \\" role=\\"button\\">label2</div></header><div class=\\"content\\"></div><style>
|
||||
.tabs {
|
||||
width: initial;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ exports[`Tabs should render correctly 1`] = `
|
||||
`;
|
||||
|
||||
exports[`Tabs should work correctly with different styles 1`] = `
|
||||
"<div class=\\"tabs \\"><header class=\\"hide-divider\\"><div class=\\"tab \\">label1</div></header><div class=\\"content\\"></div><style>
|
||||
"<div class=\\"tabs \\"><header class=\\"hide-divider\\"><div class=\\"tab \\" role=\\"button\\">label1</div></header><div class=\\"content\\"></div><style>
|
||||
.tabs {
|
||||
width: initial;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ const Tabs: React.FC<React.PropsWithChildren<TabsProps>> = ({
|
||||
className={`tab ${selfValue === item.value ? 'active' : ''} ${
|
||||
item.disabled ? 'disabled' : ''
|
||||
}`}
|
||||
role="button"
|
||||
key={item.value + index}
|
||||
onClick={() => clickHandler(item)}>
|
||||
{item.label}
|
||||
|
||||
Reference in New Issue
Block a user