diff options
author | iain holmes <iain@xamarin.com> | 2017-07-10 19:05:43 +0300 |
---|---|---|
committer | Marius Ungureanu <teromario@yahoo.com> | 2017-07-18 11:52:59 +0300 |
commit | bba532b7d920aff7cfb3e1b5e59c04e13fb3b938 (patch) | |
tree | b9c4f5c712e573afb8c099e27aebd4213b8be646 /main/src/core | |
parent | 97e71fc48404899f313f2f208154b90055a2a417 (diff) |
[A11y] Fix the keyboard focus on the editor
Now that the whole of the shell UI can be focused, lots of controls like to
steal the keyboard focus meaning that when we expect to be able to type in the
editor, we often can't. To fix this, when opening a new document, we have the
editor grab focus.
Diffstat (limited to 'main/src/core')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs | 35 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs | 1 |
2 files changed, 33 insertions, 3 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs index 08f596c6aa..b887e4d0da 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SdiWorkspaceWindow.cs @@ -354,11 +354,42 @@ namespace MonoDevelop.Ide.Gui static IEnumerable<Gtk.Widget> GetFocussableWidgets (Gtk.Widget widget) { var c = widget as Container; - if (widget.CanFocus) + + if (widget.CanFocus) { yield return widget; + } + if (c != null) { - foreach (var f in c.FocusChain.SelectMany (GetFocussableWidgets).Where (y => y != null)) + foreach (var f in c.FocusChain.SelectMany (GetFocussableWidgets).Where (y => y != null)) { yield return f; + } + } + + if (c?.Children?.Length != 0) { + foreach (var f in c.Children) { + var container = f as Container; + if (container != null) { + foreach (var child in GetFocussableChildren (container)) { + yield return child; + } + } + } + } + } + + static IEnumerable<Gtk.Widget> GetFocussableChildren (Gtk.Container container) + { + if (container.CanFocus) { + yield return container; + } + + foreach (var f in container.Children) { + var c = f as Container; + if (c != null) { + foreach (var child in GetFocussableChildren (c)) { + yield return child; + } + } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index 9a9944290d..a1c6bb1584 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -585,7 +585,6 @@ namespace MonoDevelop.Ide.Gui if (info.Options.HasFlag (OpenDocumentOptions.BringToFront)) { doc.Select (); - doc.Window.SelectWindow (); NavigationHistoryService.LogActiveDocument (); } return doc; |