aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages/ts/components/Code.tsx
diff options
context:
space:
mode:
authorAugust Skare <post@augustskare.no>2018-11-06 21:39:48 +0800
committerAugust Skare <post@augustskare.no>2018-11-06 21:39:48 +0800
commit9006e8fced685c9a6077d68691223005de2a1cbd (patch)
treed614b21b5a436bb3ad8b723e65999748cda823e5 /packages/dev-tools-pages/ts/components/Code.tsx
parent6b8f8580d841ec8525def8951ceb94d1147e74aa (diff)
downloaddexon-sol-tools-9006e8fced685c9a6077d68691223005de2a1cbd.tar
dexon-sol-tools-9006e8fced685c9a6077d68691223005de2a1cbd.tar.gz
dexon-sol-tools-9006e8fced685c9a6077d68691223005de2a1cbd.tar.bz2
dexon-sol-tools-9006e8fced685c9a6077d68691223005de2a1cbd.tar.lz
dexon-sol-tools-9006e8fced685c9a6077d68691223005de2a1cbd.tar.xz
dexon-sol-tools-9006e8fced685c9a6077d68691223005de2a1cbd.tar.zst
dexon-sol-tools-9006e8fced685c9a6077d68691223005de2a1cbd.zip
fix issues in code element
Diffstat (limited to 'packages/dev-tools-pages/ts/components/Code.tsx')
-rw-r--r--packages/dev-tools-pages/ts/components/Code.tsx3
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/dev-tools-pages/ts/components/Code.tsx b/packages/dev-tools-pages/ts/components/Code.tsx
index f83d16dfa..862e04ebf 100644
--- a/packages/dev-tools-pages/ts/components/Code.tsx
+++ b/packages/dev-tools-pages/ts/components/Code.tsx
@@ -116,6 +116,7 @@ const StyledPre = styled.pre`
`;
const StyledCopyInput = styled.textarea`
+ opacity: 0;
height: 0;
position: absolute;
top: 0;
@@ -155,9 +156,11 @@ class Code extends React.Component<CodeProps, CodeState> {
await (navigator as any).clipboard.writeText(this.props.children);
this.setState({ copied: true });
} else {
+ const lastActive = document.activeElement as HTMLElement;
this.code.current.focus();
this.code.current.select();
document.execCommand('copy');
+ lastActive.focus();
this.setState({ copied: true });
}
} catch (error) {