Merge pull request #45891 from Faless/js/4.x_editor_focus

[HTML5] Editor: ensure canvas focus when switching tabs.
This commit is contained in:
Rémi Verschelde 2021-02-11 13:16:40 +01:00 committed by GitHub
commit b9863e157e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -284,6 +284,10 @@
tabs.forEach(function (elem) {
if (elem.id == 'tab-' + name) {
elem.style.display = 'block';
if (name == 'editor' || name == 'game') {
const canvas = document.getElementById(name + '-canvas');
canvas.focus();
}
} else {
elem.style.display = 'none';
}