Commit 09e49224 authored by Abigail Klein's avatar Abigail Klein Committed by Chromium LUCI CQ

[Mac A11y] Make the toolbar an accessible group.

Give the toolbar accessible node data so that it becomes a group in the
accessibility tree. This improves the experience of navigating the
chrome for screen reader users: users can treat the toolbar as a group
and interact with it, or skip over it if they prefer. Previously, users
had to navigate through every button in the toolbar, slowing them down.

Bug: 1097760
Change-Id: Ia7aaed4d74bf081c2b41e4142d732d8b56563afa
AX-Relnotes: Make the toolbar an accessible group.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2588893
Commit-Queue: Abigail Klein <abigailbklein@google.com>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836812}
parent b24aeb40
...@@ -5902,6 +5902,9 @@ the Bookmarks menu."> ...@@ -5902,6 +5902,9 @@ the Bookmarks menu.">
<message name="IDS_ACCNAME_TAB_STRIP" desc="The accessible name for the tab strip."> <message name="IDS_ACCNAME_TAB_STRIP" desc="The accessible name for the tab strip.">
Tab strip Tab strip
</message> </message>
<message name="IDS_ACCNAME_TOOLBAR" desc="The accessible name for the toolbar.">
Toolbar
</message>
<!-- Clipboard permission --> <!-- Clipboard permission -->
<message name="IDS_ALLOWED_CLIPBOARD_TITLE" desc="Title of the info bubble shown when a site has been allowed access to read the contents of the system clipboard."> <message name="IDS_ALLOWED_CLIPBOARD_TITLE" desc="Title of the info bubble shown when a site has been allowed access to read the contents of the system clipboard.">
......
4744ce7ac506516225561500cac78792e014b60e
\ No newline at end of file
...@@ -653,26 +653,19 @@ void ToolbarView::ChildPreferredSizeChanged(views::View* child) { ...@@ -653,26 +653,19 @@ void ToolbarView::ChildPreferredSizeChanged(views::View* child) {
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// ToolbarView, protected: // ToolbarView, private:
// Override this so that when the user presses F6 to rotate toolbar panes, // Override this so that when the user presses F6 to rotate toolbar panes,
// the location bar gets focus, not the first control in the toolbar - and // the location bar gets focus, not the first control in the toolbar - and
// also so that it selects all content in the location bar. // also so that it selects all content in the location bar.
bool ToolbarView::SetPaneFocusAndFocusDefault() { views::View* ToolbarView::GetDefaultFocusableChild() {
if (!location_bar_->HasFocus()) { return location_bar_;
SetPaneFocus(location_bar_);
location_bar_->FocusLocation(true);
return true;
}
if (!AccessiblePaneView::SetPaneFocusAndFocusDefault())
return false;
browser_->window()->RotatePaneFocus(true);
return true;
} }
//////////////////////////////////////////////////////////////////////////////// void ToolbarView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
// ToolbarView, private: node_data->role = ax::mojom::Role::kToolbar;
node_data->SetName(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR));
}
void ToolbarView::InitLayout() { void ToolbarView::InitLayout() {
const int default_margin = GetLayoutConstant(TOOLBAR_ELEMENT_PADDING); const int default_margin = GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
......
...@@ -193,15 +193,16 @@ class ToolbarView : public views::AccessiblePaneView, ...@@ -193,15 +193,16 @@ class ToolbarView : public views::AccessiblePaneView,
void ChildPreferredSizeChanged(views::View* child) override; void ChildPreferredSizeChanged(views::View* child) override;
protected: protected:
// AccessiblePaneView:
bool SetPaneFocusAndFocusDefault() override;
// This controls Toolbar, LocationBar and CustomTabBar visibility. // This controls Toolbar, LocationBar and CustomTabBar visibility.
// If we don't set all three, tab navigation from the app menu breaks // If we don't set all three, tab navigation from the app menu breaks
// on Chrome OS. // on Chrome OS.
void SetToolbarVisibility(bool visible); void SetToolbarVisibility(bool visible);
private: private:
// AccessiblePaneView:
views::View* GetDefaultFocusableChild() override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
// AnimationDelegateViews: // AnimationDelegateViews:
void AnimationEnded(const gfx::Animation* animation) override; void AnimationEnded(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override; void AnimationProgressed(const gfx::Animation* animation) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment