Skip to content

Commit

Permalink
fix preference pane count tab reported by screen readers via FireFox
Browse files Browse the repository at this point in the history
  • Loading branch information
gtritchie committed Aug 14, 2019
1 parent 1772fc1 commit d348942
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/gwt/src/org/rstudio/core/client/prefs/SectionChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
import org.rstudio.core.client.a11y.A11y;
import org.rstudio.core.client.widget.DecorativeImage;

import java.util.LinkedHashSet;
import java.util.Set;

/**
* Vertical tab control used by Preferences dialogs. Follows the ARIA tab pattern.
*
Expand Down Expand Up @@ -128,6 +131,13 @@ public Id addSection(ImageResource icon, String name)
Roles.getTabRole().setAriaSelectedState(panel.getElement(), SelectedValue.FALSE);
Roles.getTabRole().setAriaControlsProperty(panel.getElement(), getTabPanelId(sectionTabId));
inner_.add(panel);

// FireFox fails to enumerate the tabs when building its accessibility tree,
// perhaps due to the deep nesting of layout tables. Use the aria-owns attribute
// to assist it. https://github.com/rstudio/rstudio/issues/5120
tabIds_.add(sectionTabId);
Roles.getTablistRole().setAriaOwnsProperty(getElement(), tabIds_.toArray(new Id[0]));

return sectionTabId;
}

Expand Down Expand Up @@ -274,6 +284,6 @@ private int sectionCount()

private Integer selectedIndex_;
private final VerticalPanel inner_ = new VerticalPanel();
private static final PreferencesDialogBaseResources res_ =
PreferencesDialogBaseResources.INSTANCE;
private static final PreferencesDialogBaseResources res_ = PreferencesDialogBaseResources.INSTANCE;
private Set<Id> tabIds_ = new LinkedHashSet<>();
}

0 comments on commit d348942

Please sign in to comment.