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

Fixing bug seeing which icon in the Simulator Control bar is Focused on when tabbing #116

Merged
merged 2 commits into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/view/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "../styles/Button.css";
export interface IButtonProps {
label: string;
image: any;
focusable: boolean;
styleLabel: string;
width: number;
onClick: (event: React.MouseEvent<HTMLElement>) => void;
Expand All @@ -13,6 +14,7 @@ export interface IButtonProps {
const Button: React.FC<IButtonProps> = props => {
const iconSvg: SVGElement = props.image as SVGElement;
const buttonStyle = { width: props.width };
const tabIndex = props.focusable ? 0 : -1;

return (
<button
Expand All @@ -22,6 +24,7 @@ const Button: React.FC<IButtonProps> = props => {
role="button"
onClick={props.onClick}
style={buttonStyle}
tabIndex={tabIndex}
>
{iconSvg}
</button>
Expand Down
2 changes: 2 additions & 0 deletions src/view/components/Simulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,15 @@ class Simulator extends React.Component<any, IState> {
<div className="buttons">
<Button
onClick={this.togglePlayClick}
focusable={true}
image={image}
styleLabel="play"
label="play"
width={SIMULATOR_BUTTON_WIDTH}
/>
<Button
onClick={this.refreshSimulatorClick}
focusable={true}
image={RefreshLogo}
styleLabel="refresh"
label="refresh"
Expand Down
12 changes: 12 additions & 0 deletions src/view/components/toolbar/ToolBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
onClick={() => {}}
image={TOOLBAR_SVG.LEFT_EDGE_SVG}
styleLabel="edge"
focusable={false}
/>
<Button
label={TOOLBAR_ICON_ID.SWITCH}
Expand All @@ -62,6 +63,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.SLIDER_SWITCH_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -72,6 +74,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.PUSH_BUTTON_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -82,6 +85,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.RED_LED_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -92,6 +96,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.SOUND_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -102,6 +107,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.TEMPERATURE_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -112,6 +118,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.LIGHT_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -122,6 +129,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.SPEAKER_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -132,6 +140,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.MOTION_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -142,6 +151,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.IR_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -152,6 +162,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
}}
image={TOOLBAR_SVG.GPIO_SVG}
styleLabel="toolbar"
focusable={true}
/>

<Button
Expand All @@ -160,6 +171,7 @@ class ToolBar extends React.Component<any, IToolbarState, any> {
onClick={() => {}}
image={TOOLBAR_SVG.RIGHT_EDGE_SVG}
styleLabel="edge"
focusable={false}
/>
</div>

Expand Down
8 changes: 1 addition & 7 deletions src/view/styles/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@
border-radius: 0px 8px 8px 0px;
}

.button:focus,
.button:hover {
background-color: var(--vscode-terminal-selectionBackground);
}

.play-button:focus,
.play-button:hover,
.refresh-button:focus,
.refresh-button:hover {
background-color: var(--vscode-terminal-selectionBackground);
}

.button:active {
background-color: var(--vscode-editor-selectionHighlightBackground);
}
Expand Down