From 9006e8fced685c9a6077d68691223005de2a1cbd Mon Sep 17 00:00:00 2001 From: August Skare Date: Tue, 6 Nov 2018 14:39:48 +0100 Subject: fix issues in code element --- packages/dev-tools-pages/ts/components/Code.tsx | 3 +++ 1 file changed, 3 insertions(+) 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 { 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) { -- cgit v1.2.3