mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
Set initial focus on an input field when opening the issue reporter
This commit is contained in:
@@ -60,6 +60,7 @@ export function startup(configuration: IssueReporterConfiguration) {
|
||||
const issueReporter = new IssueReporter(configuration);
|
||||
issueReporter.render();
|
||||
document.body.style.display = 'block';
|
||||
issueReporter.setInitialFocus();
|
||||
}
|
||||
|
||||
export class IssueReporter extends Disposable {
|
||||
@@ -142,6 +143,21 @@ export class IssueReporter extends Disposable {
|
||||
this.renderBlocks();
|
||||
}
|
||||
|
||||
setInitialFocus() {
|
||||
const { fileOnExtension } = this.issueReporterModel.getData();
|
||||
if (fileOnExtension) {
|
||||
const issueTitle = document.getElementById('issue-title');
|
||||
if (issueTitle) {
|
||||
issueTitle.focus();
|
||||
}
|
||||
} else {
|
||||
const issueType = document.getElementById('issue-type');
|
||||
if (issueType) {
|
||||
issueType.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private applyZoom(zoomLevel: number) {
|
||||
webFrame.setZoomLevel(zoomLevel);
|
||||
browser.setZoomFactor(webFrame.getZoomFactor());
|
||||
|
||||
Reference in New Issue
Block a user