mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-13 04:16:34 +03:00
fix: make sample controls focusable
This commit is contained in:
parent
05fd7543a2
commit
006031c517
|
@ -34,14 +34,14 @@ export class CopyButtonWrapper extends React.PureComponent<
|
||||||
|
|
||||||
renderCopyButton = () => {
|
renderCopyButton = () => {
|
||||||
return (
|
return (
|
||||||
<span onClick={this.copy}>
|
<button onClick={this.copy}>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={ClipboardService.isSupported() ? 'Copied' : 'Not supported in your browser'}
|
title={ClipboardService.isSupported() ? 'Copied' : 'Not supported in your browser'}
|
||||||
open={this.state.tooltipShown}
|
open={this.state.tooltipShown}
|
||||||
>
|
>
|
||||||
Copy
|
Copy
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</span>
|
</button>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,19 @@ export const SampleControls = styled.div`
|
||||||
transition: opacity 0.3s ease;
|
transition: opacity 0.3s ease;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
||||||
> span {
|
> button {
|
||||||
display: inline-block;
|
background-color: transparent;
|
||||||
|
border: 0;
|
||||||
|
color: inherit;
|
||||||
padding: 2px 10px;
|
padding: 2px 10px;
|
||||||
|
font-family: ${({ theme }) => theme.typography.fontFamily};
|
||||||
|
font-size: ${({ theme }) => theme.typography.fontSize};
|
||||||
|
line-height: ${({ theme }) => theme.typography.lineHeight};
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
outline: 0;
|
||||||
|
|
||||||
:hover {
|
:hover,
|
||||||
|
:focus {
|
||||||
background: rgba(255, 255, 255, 0.1);
|
background: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,8 @@ class Json extends React.PureComponent<JsonProps> {
|
||||||
<JsonViewerWrap>
|
<JsonViewerWrap>
|
||||||
<SampleControls>
|
<SampleControls>
|
||||||
{renderCopyButton()}
|
{renderCopyButton()}
|
||||||
<span onClick={this.expandAll}> Expand all </span>
|
<button onClick={this.expandAll}> Expand all </button>
|
||||||
<span onClick={this.collapseAll}> Collapse all </span>
|
<button onClick={this.collapseAll}> Collapse all </button>
|
||||||
</SampleControls>
|
</SampleControls>
|
||||||
<OptionsContext.Consumer>
|
<OptionsContext.Consumer>
|
||||||
{options => (
|
{options => (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user