mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Editor: Set initial focus for screen reader users
When accessibility is enabled, set initial focus on editor startup: - If the Scene dock is the active tab, focus the scene tree - Otherwise, focus the dock tab bar so the user can switch tabs This gives screen reader users a predictable starting point for keyboard navigation without overriding their saved dock layout.
This commit is contained in:
@@ -1443,6 +1443,20 @@ void EditorNode::_sources_changed(bool p_exist) {
|
||||
if (!singleton->cmdline_mode) {
|
||||
EditorResourcePreview::get_singleton()->start();
|
||||
}
|
||||
|
||||
// Set initial focus for screen reader users.
|
||||
if (get_tree()->is_accessibility_enabled()) {
|
||||
if (SceneTreeDock::get_singleton()->is_visible_in_tree()) {
|
||||
SceneTreeDock::get_singleton()->get_tree_editor()->get_scene_tree()->grab_focus();
|
||||
} else {
|
||||
TabContainer *tab_container = EditorDockManager::get_singleton()->get_dock_tab_container(SceneTreeDock::get_singleton());
|
||||
if (tab_container) {
|
||||
// Another tab is active (e.g., Import) - focus the tab bar so user can switch.
|
||||
tab_container->get_tab_bar()->grab_focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get_tree()->create_timer(1.0f)->connect("timeout", callable_mp(this, &EditorNode::_remove_lock_file));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user