diff options
-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) { |