From ad04f4466bc493f149c5b3977023237a051b0ab7 Mon Sep 17 00:00:00 2001 From: Shivam Mahajan Date: Wed, 29 Mar 2023 17:53:13 -0400 Subject: [PATCH 1/3] Added auto focus to Github URL on opening of debug logs modal --- src/components/views/dialogs/BugReportDialog.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/views/dialogs/BugReportDialog.tsx b/src/components/views/dialogs/BugReportDialog.tsx index 319f7db817f..a26bd9e6b6a 100644 --- a/src/components/views/dialogs/BugReportDialog.tsx +++ b/src/components/views/dialogs/BugReportDialog.tsx @@ -53,9 +53,10 @@ interface IState { export default class BugReportDialog extends React.Component { private unmounted: boolean; - + private issueRef: any; public constructor(props: IProps) { super(props); + this.issueRef = React.createRef(); this.state = { sendLogs: true, busy: false, @@ -66,6 +67,7 @@ export default class BugReportDialog extends React.Component { downloadBusy: false, downloadProgress: null, }; + this.unmounted = false; // Get all of the extra info dumped to the console when someone is about @@ -79,6 +81,10 @@ export default class BugReportDialog extends React.Component { }); } + public componentDidMount(): void { + this.issueRef.current?.focus(); + } + public componentWillUnmount(): void { this.unmounted = true; } @@ -255,6 +261,7 @@ export default class BugReportDialog extends React.Component { onChange={this.onIssueUrlChange} value={this.state.issueUrl} placeholder="https://github.com/vector-im/element-web/issues/..." + ref={this.issueRef} /> Date: Thu, 30 Mar 2023 11:13:14 -0400 Subject: [PATCH 2/3] Fixed the prettier formatting error --- src/components/views/dialogs/BugReportDialog.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/BugReportDialog.tsx b/src/components/views/dialogs/BugReportDialog.tsx index a26bd9e6b6a..7c90b79f7c2 100644 --- a/src/components/views/dialogs/BugReportDialog.tsx +++ b/src/components/views/dialogs/BugReportDialog.tsx @@ -67,7 +67,7 @@ export default class BugReportDialog extends React.Component { downloadBusy: false, downloadProgress: null, }; - + this.unmounted = false; // Get all of the extra info dumped to the console when someone is about @@ -84,7 +84,7 @@ export default class BugReportDialog extends React.Component { public componentDidMount(): void { this.issueRef.current?.focus(); } - + public componentWillUnmount(): void { this.unmounted = true; } From ea9e2e2f0fcb5cb61de7af1f5f2e89b53a3bc882 Mon Sep 17 00:00:00 2001 From: Shivam Mahajan Date: Sat, 1 Apr 2023 10:39:42 -0400 Subject: [PATCH 3/3] Specified the type of issueRef variable --- src/components/views/dialogs/BugReportDialog.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/dialogs/BugReportDialog.tsx b/src/components/views/dialogs/BugReportDialog.tsx index 7c90b79f7c2..ed706f97c5b 100644 --- a/src/components/views/dialogs/BugReportDialog.tsx +++ b/src/components/views/dialogs/BugReportDialog.tsx @@ -53,10 +53,11 @@ interface IState { export default class BugReportDialog extends React.Component { private unmounted: boolean; - private issueRef: any; + private issueRef: React.RefObject; + public constructor(props: IProps) { super(props); - this.issueRef = React.createRef(); + this.state = { sendLogs: true, busy: false, @@ -69,6 +70,7 @@ export default class BugReportDialog extends React.Component { }; this.unmounted = false; + this.issueRef = React.createRef(); // Get all of the extra info dumped to the console when someone is about // to send debug logs. Since this is a fire and forget action, we do