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

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28788/head^2
Shivam Mahajan 2023-04-03 05:09:32 -04:00 committed by GitHub
parent 5cd459ff2d
commit f933806b63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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,
@ -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
@ -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;
}
@ -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"