Skip to content

Commit 7d9fa37

Browse files
authored
Merge pull request #373 from iclanton/fix-playground-accessability-issues
Fix an issue where the selected tab isn't selectable via keyboard navigation.
2 parents fcffaae + 87c62f7 commit 7d9fa37

File tree

7 files changed

+40
-40
lines changed

7 files changed

+40
-40
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.github/CODEOWNERS @iclanton @nickpape-msft @octogonz
2-
common/config/**/* @iclanton @nickpape-msft @octogonz
1+
.github/CODEOWNERS @iclanton @octogonz @apostolisms @D4N14L @dmichon-msft @patmill
2+
common/config/**/* @iclanton @octogonz @apostolisms @D4N14L @dmichon-msft @patmill
33

4-
**/* @iclanton @nickpape-msft @octogonz
4+
**/* @iclanton @octogonz @apostolisms @D4N14L @dmichon-msft @patmill

common/config/azure-pipelines/ci-build.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ jobs:
44
- job: PRBuild
55
condition: succeeded()
66
strategy:
7-
maxParallel: 3
87
matrix:
9-
'NodeJs 14':
10-
NodeVersion: 14
118
'NodeJs 16':
129
NodeVersion: 16
1310
'NodeJs 18':

common/config/azure-pipelines/npm-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pool:
22
vmImage: 'ubuntu-latest'
33
variables:
4-
NodeVersion: 16
4+
NodeVersion: 18
55
FORCE_COLOR: 1
66
steps:
77
- checkout: self

common/config/azure-pipelines/npm-republish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pool:
22
vmImage: 'ubuntu-latest'
33
variables:
4-
NodeVersion: 16
4+
NodeVersion: 18
55
FORCE_COLOR: 1
66
steps:
77
- checkout: self

common/config/azure-pipelines/playground-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resources:
99
ref: refs/heads/gh-pages
1010
trigger: none
1111
variables:
12-
NodeVersion: 16
12+
NodeVersion: 18
1313
FORCE_COLOR: 1
1414
jobs:
1515
- job: build

common/config/azure-pipelines/templates/build.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ steps:
1313
displayName: 'Rush Install'
1414
- script: 'node common/scripts/install-run-rush.js rebuild --verbose --production'
1515
displayName: 'Rush Rebuild'
16+
env:
17+
# Prevent time-based browserslist update warning
18+
# See https://github.com/microsoft/rushstack/issues/2981
19+
BROWSERSLIST_IGNORE_OLD_DATA: 1

playground/src/TabPane.tsx

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export interface ITabPaneState {
1717
selectedTabIndex: number;
1818
}
1919

20+
const TAB_STYLE: React.CSSProperties = {
21+
padding: '8px',
22+
marginLeft: '1px',
23+
marginRight: '1px'
24+
};
25+
2026
export class TabPane extends React.Component<ITabPaneProps, ITabPaneState> {
2127
// Saved bindings of _onClickTab() with a tabIndex parameter, to avoid the react/jsx-no-bind issue
2228
private _onClickTabBindings: React.MouseEventHandler<HTMLAnchorElement>[] = [];
@@ -38,49 +44,42 @@ export class TabPane extends React.Component<ITabPaneProps, ITabPaneState> {
3844
for (let i: number = 0; i < this.props.tabs.length; ++i) {
3945
const tabDefinition: ITabDefinition = this.props.tabs[i];
4046

41-
const style: React.CSSProperties = {
42-
padding: '8px',
43-
marginLeft: '1px',
44-
marginRight: '1px'
45-
};
46-
47+
let ariaSelected: boolean = false;
48+
let tabStyleToUse: React.CSSProperties;
4749
if (i === this.state.selectedTabIndex) {
4850
selectedTabDefinition = tabDefinition;
51+
ariaSelected = true;
4952

50-
const activeTabStyle: React.CSSProperties = {
51-
...style,
53+
tabStyleToUse = {
54+
...TAB_STYLE,
5255
borderStyle: 'solid',
5356
borderWidth: '2px',
5457
borderColor: '#c0c0c0',
5558
borderBottomStyle: 'none',
5659
borderTopLeftRadius: '4px',
5760
borderTopRightRadius: '4px'
5861
};
59-
60-
buttons.push(
61-
<div key={`tab_${i}`} className="playground-tab-pane-active-tab" style={activeTabStyle} role="tab">
62-
{tabDefinition.title}
63-
</div>
64-
);
6562
} else {
66-
if (!this._onClickTabBindings[i]) {
67-
// Bind _onClickTab() with i as the tabIndex parameter
68-
this._onClickTabBindings[i] = this._onClickTab.bind(this, i);
69-
}
70-
71-
buttons.push(
72-
<div key={`tab_${i}`} className="playground-tab-pane-inactive-tab" style={style}>
73-
<a
74-
href="#"
75-
style={{ textDecorationLine: 'none', color: '#000000' }}
76-
onClick={this._onClickTabBindings[i]}
77-
role="tab"
78-
>
79-
{tabDefinition.title}
80-
</a>
81-
</div>
82-
);
63+
tabStyleToUse = TAB_STYLE;
8364
}
65+
66+
if (!this._onClickTabBindings[i]) {
67+
// Bind _onClickTab() with i as the tabIndex parameter
68+
this._onClickTabBindings[i] = this._onClickTab.bind(this, i);
69+
}
70+
buttons.push(
71+
<div key={`tab_${i}`} className="playground-tab-pane-inactive-tab" style={tabStyleToUse}>
72+
<a
73+
href="#"
74+
style={{ textDecorationLine: 'none', color: '#000000' }}
75+
onClick={this._onClickTabBindings[i]}
76+
role="tab"
77+
aria-selected={ariaSelected}
78+
>
79+
{tabDefinition.title}
80+
</a>
81+
</div>
82+
);
8483
}
8584

8685
const contentDivStyle: React.CSSProperties = {

0 commit comments

Comments
 (0)