Skip to content

Commit

Permalink
fix: make sample controls focusable
Browse files Browse the repository at this point in the history
  • Loading branch information
stasiukanya authored and RomanHotsiy committed Jul 13, 2020
1 parent 05fd754 commit 006031c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/common-elements/CopyButtonWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export class CopyButtonWrapper extends React.PureComponent<

renderCopyButton = () => {
return (
<span onClick={this.copy}>
<button onClick={this.copy}>
<Tooltip
title={ClipboardService.isSupported() ? 'Copied' : 'Not supported in your browser'}
open={this.state.tooltipShown}
>
Copy
</Tooltip>
</span>
</button>
);
};

Expand Down
13 changes: 10 additions & 3 deletions src/common-elements/samples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ export const SampleControls = styled.div`
transition: opacity 0.3s ease;
text-align: right;
> span {
display: inline-block;
> button {
background-color: transparent;
border: 0;
color: inherit;
padding: 2px 10px;
font-family: ${({ theme }) => theme.typography.fontFamily};
font-size: ${({ theme }) => theme.typography.fontSize};
line-height: ${({ theme }) => theme.typography.lineHeight};
cursor: pointer;
outline: 0;
:hover {
:hover,
:focus {
background: rgba(255, 255, 255, 0.1);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/JsonViewer/JsonViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Json extends React.PureComponent<JsonProps> {
<JsonViewerWrap>
<SampleControls>
{renderCopyButton()}
<span onClick={this.expandAll}> Expand all </span>
<span onClick={this.collapseAll}> Collapse all </span>
<button onClick={this.expandAll}> Expand all </button>
<button onClick={this.collapseAll}> Collapse all </button>
</SampleControls>
<OptionsContext.Consumer>
{options => (
Expand Down

0 comments on commit 006031c

Please sign in to comment.