Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Added auto focus to Github URL on opening of debug logs modal #10479

9 changes: 9 additions & 0 deletions src/components/views/dialogs/BugReportDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ interface IState {

export default class BugReportDialog extends React.Component<IProps, IState> {
private unmounted: boolean;
private issueRef: React.RefObject<Field>;

public constructor(props: IProps) {
super(props);

this.state = {
sendLogs: true,
busy: false,
Expand All @@ -66,7 +68,9 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
downloadBusy: false,
downloadProgress: null,
};

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
Expand All @@ -79,6 +83,10 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
});
}

public componentDidMount(): void {
this.issueRef.current?.focus();
}

public componentWillUnmount(): void {
this.unmounted = true;
}
Expand Down Expand Up @@ -255,6 +263,7 @@ export default class BugReportDialog extends React.Component<IProps, IState> {
onChange={this.onIssueUrlChange}
value={this.state.issueUrl}
placeholder="https://github.com/vector-im/element-web/issues/..."
ref={this.issueRef}
/>
<Field
className="mx_BugReportDialog_field_input"
Expand Down