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

Commit

Permalink
Added auto focus to Github URL on opening of debug logs modal (#10479)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Telatynski <[email protected]>
  • Loading branch information
ShivamSpm and t3chguy authored Apr 3, 2023
1 parent 5cd459f commit f933806
Showing 1 changed file with 9 additions and 0 deletions.
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

0 comments on commit f933806

Please sign in to comment.