27
27
using System ;
28
28
using System . Collections . Generic ;
29
29
using System . Linq ;
30
+ using MonoDevelop . Components . AtkCocoaHelper ;
30
31
using MonoDevelop . Core ;
31
32
using MonoDevelop . Ide ;
32
33
using MonoDevelop . Projects ;
@@ -90,7 +91,6 @@ public ManagePackagesDialog (
90
91
consolidateLabel . Visible = viewModel . IsManagingSolution ;
91
92
UpdateDialogTitle ( ) ;
92
93
UpdatePackageSearchEntryWithInitialText ( initialSearch ) ;
93
- UpdatePackageResultsPageLabels ( ) ;
94
94
95
95
InitializeListView ( ) ;
96
96
UpdateAddPackagesButton ( ) ;
@@ -113,6 +113,33 @@ public ManagePackagesDialog (
113
113
updatesLabel . KeyPressed += UpdatesLabelKeyPressed ;
114
114
consolidateLabel . ButtonPressed += ConsolidateLabelButtonPressed ;
115
115
consolidateLabel . KeyPressed += ConsolidateLabelKeyPressed ;
116
+ UpdateTabAccessibility ( ) ;
117
+ UpdatePackageResultsPageLabels ( ) ;
118
+ }
119
+
120
+ void UpdateTabAccessibility ( )
121
+ {
122
+ if ( tabGroup . Surface . ToolkitEngine . Type == ToolkitType . Gtk ) {
123
+ if ( consolidateLabel . Parent . Surface . NativeWidget is Gtk . Container a11yGroup ) {
124
+ a11yGroup . Accessible . SetRole ( AtkCocoa . Roles . AXTabGroup ) ;
125
+ var children = a11yGroup . Children ;
126
+ var tabs = new List < Atk . Object > ( children . Length ) ;
127
+ foreach ( var child in children ) {
128
+ if ( ! child . Visible )
129
+ continue ;
130
+ if ( child is Gtk . EventBox box && box . Child is Gtk . Label ) {
131
+ box . Accessible . SetTitleUIElement ( box . Child . Accessible ) ;
132
+ box . Child . Accessible . SetShouldIgnore ( true ) ;
133
+ }
134
+ var tab = child . Accessible ;
135
+ tab . SetRole ( AtkCocoa . Roles . AXRadioButton ) ;
136
+ tab . SetSubRole ( AtkCocoa . SubRoles . AXTabButton ) ;
137
+ tab . SetValue ( false ) ;
138
+ tabs . Add ( tab ) ;
139
+ }
140
+ a11yGroup . Accessible . SetTabs ( tabs . ToArray ( ) ) ;
141
+ }
142
+ }
116
143
}
117
144
118
145
public bool ShowPreferencesForPackageSources { get ; private set ; }
@@ -1110,12 +1137,26 @@ void UpdatePackageResultsLabel (ManagePackagesPage page, Label label)
1110
1137
{
1111
1138
string text = ( string ) label . Tag ;
1112
1139
if ( page == viewModel . PageSelected ) {
1140
+ UpdatePackageResultsLabelA11y ( label , true ) ;
1113
1141
label . Markup = string . Format ( "<b><u>{0}</u></b>" , text ) ;
1114
1142
} else {
1143
+ UpdatePackageResultsLabelA11y ( label , false ) ;
1115
1144
label . Markup = text ;
1116
1145
}
1117
1146
}
1118
1147
1148
+ static void UpdatePackageResultsLabelA11y ( Label label , bool active )
1149
+ {
1150
+ if ( label . Surface . ToolkitEngine . Type == ToolkitType . Gtk ) {
1151
+ var widget = label . Surface . NativeWidget as Gtk . Widget ;
1152
+ if ( widget != null ) {
1153
+ widget . Accessible . SetValue ( active ) ;
1154
+ // FIXME: Accessible.SetValue has no effect, so set the role description instead
1155
+ widget . Accessible . SetRole ( AtkCocoa . Roles . AXRadioButton , active ? "selected tab" : "tab" ) ;
1156
+ }
1157
+ }
1158
+ }
1159
+
1119
1160
void UpdatePackageResultsLabel ( ManagePackagesPage page , Button label )
1120
1161
{
1121
1162
string text = ( string ) label . Tag ;
0 commit comments