Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 8c555df

Browse files
authored
Merge pull request #9167 from mono/fix753572-a11y-connected-services
[ConnectedServices] Add accessibility support to the connected services view
2 parents 853f0aa + fdcd668 commit 8c555df

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

main/src/addins/MonoDevelop.ConnectedServices/Gui.ServicesTab/ConfigurationSectionWidget.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public ConfigurationSectionWidget (IConfigurationSection section)
8181
statusLabel.TextColor = Styles.SecondaryTextColor;
8282

8383
statusImage = new ImageView (ImageService.GetIcon ("md-checkmark").WithSize (IconSize.Small));
84+
statusImage.Accessible.LabelWidget = statusLabel;
8485

8586
statusBox = new HBox ();
8687
statusBox.MarginLeft = 10;
@@ -94,6 +95,10 @@ public ConfigurationSectionWidget (IConfigurationSection section)
9495
headerTitle.PackStart (titleLabel);
9596
headerTitle.PackStart (statusBox);
9697

98+
headerTitle.Accessible.Role = Xwt.Accessibility.Role.Disclosure;
99+
headerTitle.Accessible.IsAccessible = true;
100+
headerTitle.Accessible.LabelWidget = titleLabel;
101+
97102
header.PackStart (headerTitle);
98103

99104
addBtn = new Button (GettextCatalog.GetString ("Add to the project"));

main/src/addins/MonoDevelop.ConnectedServices/Gui.ServicesTab/DependenciesSectionWidget.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ public DependenciesSectionWidget (IConfigurationSection section)
3535
}
3636

3737
bool firstCategory = true;
38+
widget.Accessible.Role = Xwt.Accessibility.Role.Group;
39+
widget.Accessible.Label = GettextCatalog.GetString ("Dependencies");
40+
widget.Accessible.IsAccessible = true;
3841

3942
foreach (var category in this.section.Service.Dependencies.Select (d => d.Category).Distinct ()) {
4043
var categoryIcon = new ImageView (category.Icon.WithSize (IconSize.Small));
44+
categoryIcon.Accessible.Label = GettextCatalog.GetString ("Category");
4145
var categoryLabel = new Label (category.Name);
4246
var categoryBox = new HBox ();
4347

@@ -48,10 +52,16 @@ public DependenciesSectionWidget (IConfigurationSection section)
4852
categoryBox.PackStart (categoryLabel);
4953
widget.PackStart (categoryBox);
5054

55+
var dependenciesGroup = new VBox () {
56+
MarginLeft = category.Icon.Size.Width / 2
57+
};
58+
dependenciesGroup.Accessible.Role = Xwt.Accessibility.Role.Group;
59+
dependenciesGroup.Accessible.LabelWidget = categoryLabel;
60+
dependenciesGroup.Accessible.IsAccessible = true;
61+
widget.PackStart (dependenciesGroup);
62+
5163
foreach (var dependency in this.section.Service.Dependencies.Where (d => d.Category == category)) {
52-
widget.PackStart (new DependencyWidget (section.Service, dependency) {
53-
MarginLeft = category.Icon.Size.Width / 2
54-
});
64+
dependenciesGroup.PackStart (new DependencyWidget (section.Service, dependency));
5565
}
5666

5767
if (firstCategory)
@@ -93,13 +103,23 @@ public DependencyWidget (IConnectedService service, IConnectedServiceDependency
93103
container.PackStart (statusIconView);
94104
container.PackStart (statusLabel);
95105

106+
Accessible.Role = Xwt.Accessibility.Role.Group;
107+
Accessible.IsAccessible = true;
108+
Accessible.LabelWidget = nameLabel;
109+
96110
Content = container;
97111
Update ();
98112

99113
dependency.StatusChanged += HandleDependencyStatusChange;
100114
service.StatusChanged += HandleServiceStatusChanged;
101115
}
102116

117+
void UpdateAccessibility ()
118+
{
119+
iconView.Accessible.LabelWidget = nameLabel;
120+
statusIconView.Accessible.Label = GettextCatalog.GetString ("Status");
121+
}
122+
103123
void SetStatusIcon (IconId stockId, double alpha = 1.0)
104124
{
105125
animatedStatusIcon = null;
@@ -148,6 +168,7 @@ void Update ()
148168
else
149169
SetStatusIcon (IconId.Null);
150170
}
171+
UpdateAccessibility ();
151172
}
152173

153174
void HandleDependencyStatusChange (object sender, StatusChangedEventArgs e)

main/src/addins/MonoDevelop.ConnectedServices/Gui.ServicesTab/ServiceDetailsWidget.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public ServiceDetailsWidget ()
2424

2525
var container = new VBox ();
2626

27+
Accessible.Role = Xwt.Accessibility.Role.Group;
28+
Accessible.IsAccessible = true;
29+
2730
details = new ServiceWidget (true);
2831
details.BorderWidth = 1;
2932
details.CornerRadius = new Components.RoundedFrameBox.BorderCornerRadius (6, 6, 0, 0);
@@ -80,6 +83,8 @@ public void LoadService (IConnectedService service)
8083
if (service.Status == Status.Added) {
8184
ExpandFirstOrUnconfiguredSection ();
8285
}
86+
87+
Accessible.Label = service.DisplayName;
8388
}
8489

8590
void HandleServiceStatusChanged (object sender, StatusChangedEventArgs e)

main/src/addins/MonoDevelop.ConnectedServices/Gui.ServicesTab/ServiceWidget.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public IConnectedService Service {
5050
service.StatusChanged += HandleServiceStatusChanged;
5151

5252
UpdateServiceStatus ();
53+
UpdateAccessibility ();
5354
}
5455
}
5556

@@ -151,6 +152,19 @@ public ServiceWidget (bool showDetails = false)
151152

152153
Content = container;
153154
ShowDetails = showDetails;
155+
156+
UpdateAccessibility ();
157+
}
158+
159+
void UpdateAccessibility ()
160+
{
161+
Accessible.IsAccessible = true;
162+
Accessible.Role = ShowDetails ? Xwt.Accessibility.Role.Group : Xwt.Accessibility.Role.Button;
163+
Accessible.LabelWidget = title;
164+
165+
addButton.Accessible.LabelWidget = title;
166+
167+
image.Accessible.Label = GettextCatalog.GetString ("Service Icon");
154168
}
155169

156170
void HandleAddButtonClicked (object sender, EventArgs e)

main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ExtendedHeaderBox.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public string BackButtonTooltip {
107107
backButtonTooltip = value;
108108
if (BackButtonVisible)
109109
backButton.TooltipText = value;
110+
backButton.Accessible.Title = value;
110111
}
111112
}
112113

@@ -190,6 +191,7 @@ public ExtendedHeaderBox (string title, string subtitle = null, Image image = nu
190191
TextColor = Styles.SecondaryTextColor,
191192
Font = font.WithSize (14),
192193
};
194+
headerSeparator.Accessible.IsAccessible = false;
193195

194196
headerSubtitle = new Label {
195197
TextColor = Styles.SecondaryTextColor,

0 commit comments

Comments
 (0)