Skip to content

Commit

Permalink
Exclude toolbar buttons from default focus navigation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudcolas committed Dec 2, 2017
1 parent df6756b commit f627456
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

### Changed

* Exclude toolbar buttons from default focus navigation flow.

### Removed

* Remove Save and Cancel buttons from image block, thanks to [@allcaps](https://github.com/allcaps) ([#102](https://github.com/springload/draftail/pull/102))
Expand Down
1 change: 1 addition & 0 deletions lib/components/ToolbarButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class ToolbarButton extends Component {
type="button"
aria-label={title || null}
data-balloon={title && showTooltipOnHover ? true : null}
tabIndex={-1}
onMouseDown={this.onMouseDown}
onMouseLeave={this.onMouseLeave}
>
Expand Down
11 changes: 2 additions & 9 deletions lib/components/ToolbarButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,16 @@
font-weight: 600;
cursor: pointer;

&:hover,
&:focus {
&:hover {
color: inherit;
background-color: rgba(0, 0, 0, 0.05);
}

&:focus {
border: 1px solid $color-editor-chrome-active;
outline: 0;
}

&--active {
background-color: rgba(0, 0, 0, 0.1);
border: 1px solid rgba(0, 0, 0, 0.2);

&:hover,
&:focus {
&:hover {
background-color: rgba(0, 0, 0, 0.1);
}
}
Expand Down
6 changes: 6 additions & 0 deletions lib/components/__snapshots__/ToolbarButton.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ exports[`ToolbarButton #active 1`] = `
name={null}
onMouseDown={[Function]}
onMouseLeave={[Function]}
tabIndex={-1}
type="button"
/>
`;
Expand All @@ -20,6 +21,7 @@ exports[`ToolbarButton #icon 1`] = `
name={null}
onMouseDown={[Function]}
onMouseLeave={[Function]}
tabIndex={-1}
type="button"
>
<Icon
Expand All @@ -38,6 +40,7 @@ exports[`ToolbarButton #label 1`] = `
name={null}
onMouseDown={[Function]}
onMouseLeave={[Function]}
tabIndex={-1}
type="button"
>
Test label
Expand All @@ -52,6 +55,7 @@ exports[`ToolbarButton #name 1`] = `
name="TEST"
onMouseDown={[Function]}
onMouseLeave={[Function]}
tabIndex={-1}
type="button"
/>
`;
Expand All @@ -64,6 +68,7 @@ exports[`ToolbarButton #title 1`] = `
name={null}
onMouseDown={[Function]}
onMouseLeave={[Function]}
tabIndex={-1}
type="button"
/>
`;
Expand All @@ -76,6 +81,7 @@ exports[`ToolbarButton empty 1`] = `
name={null}
onMouseDown={[Function]}
onMouseLeave={[Function]}
tabIndex={-1}
type="button"
/>
`;

0 comments on commit f627456

Please sign in to comment.