Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 4dae998

Browse files
authored
Fixing bug seeing which icon in the Simulator Control bar is Focused on when tabbing (#116)
[BUG : 32713] * Adding the focus class to all buttons to see which file is being tabbed on in the Simulator control bar * Adding a focusable attribute to prevent tab on edges
1 parent a685755 commit 4dae998

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

src/view/components/Button.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import "../styles/Button.css";
44
export interface IButtonProps {
55
label: string;
66
image: any;
7+
focusable: boolean;
78
styleLabel: string;
89
width: number;
910
onClick: (event: React.MouseEvent<HTMLElement>) => void;
@@ -13,6 +14,7 @@ export interface IButtonProps {
1314
const Button: React.FC<IButtonProps> = props => {
1415
const iconSvg: SVGElement = props.image as SVGElement;
1516
const buttonStyle = { width: props.width };
17+
const tabIndex = props.focusable ? 0 : -1;
1618

1719
return (
1820
<button
@@ -22,6 +24,7 @@ const Button: React.FC<IButtonProps> = props => {
2224
role="button"
2325
onClick={props.onClick}
2426
style={buttonStyle}
27+
tabIndex={tabIndex}
2528
>
2629
{iconSvg}
2730
</button>

src/view/components/Simulator.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ class Simulator extends React.Component<any, IState> {
132132
<div className="buttons">
133133
<Button
134134
onClick={this.togglePlayClick}
135+
focusable={true}
135136
image={image}
136137
styleLabel="play"
137138
label="play"
138139
width={SIMULATOR_BUTTON_WIDTH}
139140
/>
140141
<Button
141142
onClick={this.refreshSimulatorClick}
143+
focusable={true}
142144
image={RefreshLogo}
143145
styleLabel="refresh"
144146
label="refresh"

src/view/components/toolbar/ToolBar.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
5353
onClick={() => {}}
5454
image={TOOLBAR_SVG.LEFT_EDGE_SVG}
5555
styleLabel="edge"
56+
focusable={false}
5657
/>
5758
<Button
5859
label={TOOLBAR_ICON_ID.SWITCH}
@@ -62,6 +63,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
6263
}}
6364
image={TOOLBAR_SVG.SLIDER_SWITCH_SVG}
6465
styleLabel="toolbar"
66+
focusable={true}
6567
/>
6668

6769
<Button
@@ -72,6 +74,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
7274
}}
7375
image={TOOLBAR_SVG.PUSH_BUTTON_SVG}
7476
styleLabel="toolbar"
77+
focusable={true}
7578
/>
7679

7780
<Button
@@ -82,6 +85,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
8285
}}
8386
image={TOOLBAR_SVG.RED_LED_SVG}
8487
styleLabel="toolbar"
88+
focusable={true}
8589
/>
8690

8791
<Button
@@ -92,6 +96,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
9296
}}
9397
image={TOOLBAR_SVG.SOUND_SVG}
9498
styleLabel="toolbar"
99+
focusable={true}
95100
/>
96101

97102
<Button
@@ -102,6 +107,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
102107
}}
103108
image={TOOLBAR_SVG.TEMPERATURE_SVG}
104109
styleLabel="toolbar"
110+
focusable={true}
105111
/>
106112

107113
<Button
@@ -112,6 +118,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
112118
}}
113119
image={TOOLBAR_SVG.LIGHT_SVG}
114120
styleLabel="toolbar"
121+
focusable={true}
115122
/>
116123

117124
<Button
@@ -122,6 +129,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
122129
}}
123130
image={TOOLBAR_SVG.SPEAKER_SVG}
124131
styleLabel="toolbar"
132+
focusable={true}
125133
/>
126134

127135
<Button
@@ -132,6 +140,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
132140
}}
133141
image={TOOLBAR_SVG.MOTION_SVG}
134142
styleLabel="toolbar"
143+
focusable={true}
135144
/>
136145

137146
<Button
@@ -142,6 +151,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
142151
}}
143152
image={TOOLBAR_SVG.IR_SVG}
144153
styleLabel="toolbar"
154+
focusable={true}
145155
/>
146156

147157
<Button
@@ -152,6 +162,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
152162
}}
153163
image={TOOLBAR_SVG.GPIO_SVG}
154164
styleLabel="toolbar"
165+
focusable={true}
155166
/>
156167

157168
<Button
@@ -160,6 +171,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
160171
onClick={() => {}}
161172
image={TOOLBAR_SVG.RIGHT_EDGE_SVG}
162173
styleLabel="edge"
174+
focusable={false}
163175
/>
164176
</div>
165177

src/view/styles/Button.css

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,11 @@
1616
border-radius: 0px 8px 8px 0px;
1717
}
1818

19+
.button:focus,
1920
.button:hover {
2021
background-color: var(--vscode-terminal-selectionBackground);
2122
}
2223

23-
.play-button:focus,
24-
.play-button:hover,
25-
.refresh-button:focus,
26-
.refresh-button:hover {
27-
background-color: var(--vscode-terminal-selectionBackground);
28-
}
29-
3024
.button:active {
3125
background-color: var(--vscode-editor-selectionHighlightBackground);
3226
}

0 commit comments

Comments
 (0)