diff options
author | Dmitriy K <dmitriy.kirakosyan@gmail.com> | 2018-11-29 15:12:48 +0300 |
---|---|---|
committer | Dmitriy K <dmitriy.kirakosyan@gmail.com> | 2018-11-29 15:13:01 +0300 |
commit | 4c834724f39e6732cf55d2098d1e838206e375ae (patch) | |
tree | 4b7b5ec6a6cc871be07231a72050145a405ef75d /Xwt.Gtk/Xwt.GtkBackend/AccessibleBackend.cs | |
parent | 2abba7b56283ec27cd1632b5e4f10dd1dfc56ae1 (diff) |
[a11y][mac] Add Platform.IsMac condition for the fix
Diffstat (limited to 'Xwt.Gtk/Xwt.GtkBackend/AccessibleBackend.cs')
-rw-r--r-- | Xwt.Gtk/Xwt.GtkBackend/AccessibleBackend.cs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/AccessibleBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/AccessibleBackend.cs index 24919768..c1a434ba 100644 --- a/Xwt.Gtk/Xwt.GtkBackend/AccessibleBackend.cs +++ b/Xwt.Gtk/Xwt.GtkBackend/AccessibleBackend.cs @@ -61,17 +61,21 @@ namespace Xwt.GtkBackend { var backend = parentWidget as WidgetBackend; Gtk.Widget nativeWidget = null; - - // Gtk.ComboBox and Gtk.ComboBoxEntry are containers, so we apply a11y properties to their children. - // For Gtk.ComboBoxEntry it is Gtk.Entry, for Gtk.ComboBox -- Gtk.ToggleButton - - if (backend is IComboBoxEntryBackend) { - nativeWidget = (backend?.Widget as Gtk.Bin)?.Child; - } else if (backend is IComboBoxBackend) { - foreach (var child in ((Gtk.Container)backend.Widget).AllChildren) { - if (child is Gtk.ToggleButton) { - nativeWidget = (Gtk.Widget)child; - break; + + // Needed only for AtkCocoa. + if (Platform.IsMac) { + // Gtk.ComboBox and Gtk.ComboBoxEntry a11y doesn't work with Gtk/AtkCocoa. + // Workaround: + // Set a11y properties to their children. + // For Gtk.ComboBoxEntry use its Gtk.Entry, for Gtk.ComboBox -- Gtk.ToggleButton. + if (backend is IComboBoxEntryBackend) { + nativeWidget = (backend?.Widget as Gtk.Bin)?.Child; + } else if (backend is IComboBoxBackend) { + foreach (var child in ((Gtk.Container)backend.Widget).AllChildren) { + if (child is Gtk.ToggleButton) { + nativeWidget = (Gtk.Widget)child; + break; + } } } } |