diff options
author | August Skare <post@augustskare.no> | 2018-11-06 21:39:48 +0800 |
---|---|---|
committer | August Skare <post@augustskare.no> | 2018-11-06 21:39:48 +0800 |
commit | 9006e8fced685c9a6077d68691223005de2a1cbd (patch) | |
tree | d614b21b5a436bb3ad8b723e65999748cda823e5 /packages | |
parent | 6b8f8580d841ec8525def8951ceb94d1147e74aa (diff) | |
download | dexon-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')
-rw-r--r-- | packages/dev-tools-pages/ts/components/Code.tsx | 3 |
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) { |