From: Mathieu Suen Date: Fri, 7 Oct 2022 09:35:49 +0000 (+0200) Subject: SONAR-16949 Keyboard focus is lost or misplaced due to user interaction or content... X-Git-Tag: 9.7.0.61563~108 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=67bf505e5fd7df1e06994dcd9e857be9688e093f;p=sonarqube.git SONAR-16949 Keyboard focus is lost or misplaced due to user interaction or content update --- diff --git a/server/sonar-web/src/main/js/components/controls/clipboard.tsx b/server/sonar-web/src/main/js/components/controls/clipboard.tsx index c72336dc7fa..34fe96012bd 100644 --- a/server/sonar-web/src/main/js/components/controls/clipboard.tsx +++ b/server/sonar-web/src/main/js/components/controls/clipboard.tsx @@ -32,7 +32,6 @@ export interface State { interface RenderProps { setCopyButton: (node: HTMLElement | null) => void; copySuccess: boolean; - role: string; } interface Props { @@ -77,6 +76,9 @@ export class ClipboardBase extends React.PureComponent { handleSuccessCopy = () => { if (this.mounted) { this.setState({ copySuccess: true }); + if (this.copyButton) { + this.copyButton.focus(); + } setTimeout(() => { if (this.mounted) { this.setState({ copySuccess: false }); @@ -88,8 +90,7 @@ export class ClipboardBase extends React.PureComponent { render() { return this.props.children({ setCopyButton: this.setCopyButton, - copySuccess: this.state.copySuccess, - role: 'button' + copySuccess: this.state.copySuccess }); } }