Commit 0f22b0c1 authored by zelidrag@chromium.org's avatar zelidrag@chromium.org

Fixed several accessibility issues in bookmark bubble dialog:

1. BookmarkBubbleView: added BookmarkBubbleView::GetAccessibleState() so we can say what this UI is all about
2. BookmarkBubbleView: added spoken feedback to [Name] text box
3. BookmarkBubbleView: changed spoken feedback for for [Folder] to "Bookmark folder"
4. fixed AccessibilityEventRouterViews::GetViewContext() to prevent drilling down into child elements of a dialog if the dialog defines AccessibleViewState::name already.
5. BookmarkEditorView: added BookmarkBubbleView::GetAccessibleState() so we can say what this UI is all about
6. BookmarkEditorView: changed spoken feedback for for [Name] and [URL] text edit fields


BUG=177321,127042
TEST=manual with spoken feedback turned on

Review URL: https://codereview.chromium.org/79273002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236841 0039d316-1c4b-4281-b951-d872f2087c98
parent 05a8c33a
...@@ -183,12 +183,21 @@ ...@@ -183,12 +183,21 @@
<message name="IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK" desc="Title of the bubble when re-clicking on a bookmark"> <message name="IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK" desc="Title of the bubble when re-clicking on a bookmark">
Bookmark Bookmark
</message> </message>
<message name="IDS_BOOKMARK_AX_BUBBLE_PAGE_BOOKMARK" desc="Title of the bubble when re-clicking on a bookmark, read by spoken feedback">
Edit bookmark
</message>
<message name="IDS_BOOKMARK_BUBBLE_TITLE_TEXT" desc="Text preceding the title of the page that was bookmarked"> <message name="IDS_BOOKMARK_BUBBLE_TITLE_TEXT" desc="Text preceding the title of the page that was bookmarked">
Name: Name:
</message> </message>
<message name="IDS_BOOKMARK_AX_BUBBLE_TITLE_TEXT" desc="Text preceding the title of the page that was bookmarked, read by spoken feedback">
Bookmark name
</message>
<message name="IDS_BOOKMARK_BUBBLE_FOLDER_TEXT" desc="Text preceding the folder selector"> <message name="IDS_BOOKMARK_BUBBLE_FOLDER_TEXT" desc="Text preceding the folder selector">
Folder: Folder:
</message> </message>
<message name="IDS_BOOKMARK_AX_BUBBLE_FOLDER_TEXT" desc="Text preceding the folder selector">
Bookmark folder
</message>
<message name="IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK" desc="Title of the button for removing the bookmark"> <message name="IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK" desc="Title of the button for removing the bookmark">
Remove Remove
</message> </message>
...@@ -220,9 +229,15 @@ ...@@ -220,9 +229,15 @@
<message name="IDS_BOOKMARK_EDITOR_NAME_LABEL" desc="Label shown before the title/name of the URL."> <message name="IDS_BOOKMARK_EDITOR_NAME_LABEL" desc="Label shown before the title/name of the URL.">
Name: Name:
</message> </message>
<message name="IDS_BOOKMARK_AX_EDITOR_NAME_LABEL" desc="Spoken text for bookmark name text field in edit folder dialog">
Bookmark name
</message>
<message name="IDS_BOOKMARK_BAR_EDIT_FOLDER_LABEL" desc="Title of label before text field in edit folder dialog"> <message name="IDS_BOOKMARK_BAR_EDIT_FOLDER_LABEL" desc="Title of label before text field in edit folder dialog">
Name: Name:
</message> </message>
<message name="IDS_BOOKMARK_AX_EDITOR_URL_LABEL" desc="Spoken text for bookmark URL text field in edit folder dialog.">
Bookmark URL
</message>
<message name="IDS_BOOKMARK_EDITOR_URL_LABEL" desc="Label shown before the URL."> <message name="IDS_BOOKMARK_EDITOR_URL_LABEL" desc="Label shown before the URL.">
URL: URL:
</message> </message>
......
...@@ -174,6 +174,7 @@ void AccessibilityEventRouterViews::DispatchAccessibilityEvent( ...@@ -174,6 +174,7 @@ void AccessibilityEventRouterViews::DispatchAccessibilityEvent(
switch (state.role) { switch (state.role) {
case ui::AccessibilityTypes::ROLE_ALERT: case ui::AccessibilityTypes::ROLE_ALERT:
case ui::AccessibilityTypes::ROLE_DIALOG:
case ui::AccessibilityTypes::ROLE_WINDOW: case ui::AccessibilityTypes::ROLE_WINDOW:
SendWindowNotification(view, type, profile); SendWindowNotification(view, type, profile);
break; break;
...@@ -395,9 +396,11 @@ std::string AccessibilityEventRouterViews::GetViewContext(views::View* view) { ...@@ -395,9 +396,11 @@ std::string AccessibilityEventRouterViews::GetViewContext(views::View* view) {
// Two cases are handled right now. More could be added in the future // Two cases are handled right now. More could be added in the future
// depending on how the UI evolves. // depending on how the UI evolves.
// A control in a toolbar should use the toolbar's accessible name // A control inside of alert, toolbar or dialog should use that container's
// as the context. // accessible name.
if (state.role == ui::AccessibilityTypes::ROLE_TOOLBAR && if ((state.role == ui::AccessibilityTypes::ROLE_ALERT ||
state.role == ui::AccessibilityTypes::ROLE_DIALOG ||
state.role == ui::AccessibilityTypes::ROLE_TOOLBAR) &&
!state.name.empty()) { !state.name.empty()) {
return UTF16ToUTF8(state.name); return UTF16ToUTF8(state.name);
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "content/public/browser/user_metrics.h" #include "content/public/browser/user_metrics.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/theme_resources.h" #include "grit/theme_resources.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
...@@ -153,7 +154,8 @@ void BookmarkBubbleView::Init() { ...@@ -153,7 +154,8 @@ void BookmarkBubbleView::Init() {
parent_combobox_ = new views::Combobox(&parent_model_); parent_combobox_ = new views::Combobox(&parent_model_);
parent_combobox_->set_listener(this); parent_combobox_->set_listener(this);
parent_combobox_->SetAccessibleName(combobox_label->text()); parent_combobox_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_FOLDER_TEXT));
GridLayout* layout = new GridLayout(this); GridLayout* layout = new GridLayout(this);
SetLayoutManager(layout); SetLayoutManager(layout);
...@@ -199,6 +201,9 @@ void BookmarkBubbleView::Init() { ...@@ -199,6 +201,9 @@ void BookmarkBubbleView::Init() {
layout->AddView(label); layout->AddView(label);
title_tf_ = new views::Textfield(); title_tf_ = new views::Textfield();
title_tf_->SetText(GetTitle()); title_tf_->SetText(GetTitle());
title_tf_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_BUBBLE_TITLE_TEXT));
layout->AddView(title_tf_, 5, 1); layout->AddView(title_tf_, 5, 1);
layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing); layout->AddPaddingRow(0, views::kUnrelatedControlHorizontalSpacing);
...@@ -289,6 +294,14 @@ gfx::Size BookmarkBubbleView::GetMinimumSize() { ...@@ -289,6 +294,14 @@ gfx::Size BookmarkBubbleView::GetMinimumSize() {
return size; return size;
} }
void BookmarkBubbleView::GetAccessibleState(ui::AccessibleViewState* state) {
BubbleDelegateView::GetAccessibleState(state);
state->name =
l10n_util::GetStringUTF16(
newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED :
IDS_BOOKMARK_AX_BUBBLE_PAGE_BOOKMARK);
}
void BookmarkBubbleView::ButtonPressed(views::Button* sender, void BookmarkBubbleView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
HandleButtonPressed(sender); HandleButtonPressed(sender);
......
...@@ -77,6 +77,7 @@ class BookmarkBubbleView : public views::BubbleDelegateView, ...@@ -77,6 +77,7 @@ class BookmarkBubbleView : public views::BubbleDelegateView,
// Overridden from views::View: // Overridden from views::View:
virtual gfx::Size GetMinimumSize() OVERRIDE; virtual gfx::Size GetMinimumSize() OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
// Overridden from views::ButtonListener: // Overridden from views::ButtonListener:
// Closes the bubble or opens the edit dialog. // Closes the bubble or opens the edit dialog.
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "grit/chromium_strings.h" #include "grit/chromium_strings.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "grit/locale_settings.h" #include "grit/locale_settings.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/views/background.h" #include "ui/views/background.h"
...@@ -163,6 +164,12 @@ bool BookmarkEditorView::HandleKeyEvent(views::Textfield* sender, ...@@ -163,6 +164,12 @@ bool BookmarkEditorView::HandleKeyEvent(views::Textfield* sender,
return false; return false;
} }
void BookmarkEditorView::GetAccessibleState(ui::AccessibleViewState* state) {
state->name =
l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_TITLE);
state->role = ui::AccessibilityTypes::ROLE_DIALOG;
}
void BookmarkEditorView::ButtonPressed(views::Button* sender, void BookmarkEditorView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
DCHECK_EQ(new_folder_button_.get(), sender); DCHECK_EQ(new_folder_button_.get(), sender);
...@@ -270,9 +277,10 @@ void BookmarkEditorView::Init() { ...@@ -270,9 +277,10 @@ void BookmarkEditorView::Init() {
title = details_.title; title = details_.title;
} }
title_tf_ = new views::Textfield; title_tf_ = new views::Textfield;
title_tf_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_EDITOR_NAME_LABEL));
title_tf_->SetText(title); title_tf_->SetText(title);
title_tf_->SetController(this); title_tf_->SetController(this);
title_tf_->SetAccessibleName(title_label_->text());
if (show_tree_) { if (show_tree_) {
tree_view_ = new views::TreeView; tree_view_ = new views::TreeView;
...@@ -328,7 +336,8 @@ void BookmarkEditorView::Init() { ...@@ -328,7 +336,8 @@ void BookmarkEditorView::Init() {
profile_ ? user_prefs::UserPrefs::Get(profile_) : NULL; profile_ ? user_prefs::UserPrefs::Get(profile_) : NULL;
url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs)); url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url, prefs));
url_tf_->SetController(this); url_tf_->SetController(this);
url_tf_->SetAccessibleName(url_label_->text()); url_tf_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_EDITOR_URL_LABEL));
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
......
...@@ -88,6 +88,7 @@ class BookmarkEditorView : public BookmarkEditor, ...@@ -88,6 +88,7 @@ class BookmarkEditorView : public BookmarkEditor,
// views::View: // views::View:
virtual gfx::Size GetPreferredSize() OVERRIDE; virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
// views::TreeViewController: // views::TreeViewController:
virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view) OVERRIDE; virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view) OVERRIDE;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ui/views/bubble/bubble_delegate.h" #include "ui/views/bubble/bubble_delegate.h"
#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/gfx/animation/slide_animation.h" #include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/color_utils.h" #include "ui/gfx/color_utils.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
...@@ -138,6 +139,10 @@ NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView( ...@@ -138,6 +139,10 @@ NonClientFrameView* BubbleDelegateView::CreateNonClientFrameView(
return frame; return frame;
} }
void BubbleDelegateView::GetAccessibleState(ui::AccessibleViewState* state) {
state->role = ui::AccessibilityTypes::ROLE_DIALOG;
}
void BubbleDelegateView::OnWidgetDestroying(Widget* widget) { void BubbleDelegateView::OnWidgetDestroying(Widget* widget) {
if (anchor_widget() == widget) if (anchor_widget() == widget)
SetAnchorView(NULL); SetAnchorView(NULL);
......
...@@ -34,12 +34,13 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, ...@@ -34,12 +34,13 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
// Create and initialize the bubble Widget(s) with proper bounds. // Create and initialize the bubble Widget(s) with proper bounds.
static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); static Widget* CreateBubble(BubbleDelegateView* bubble_delegate);
// WidgetDelegate overrides: // WidgetDelegateView overrides:
virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE; virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE;
virtual bool CanActivate() const OVERRIDE; virtual bool CanActivate() const OVERRIDE;
virtual bool ShouldShowCloseButton() const OVERRIDE; virtual bool ShouldShowCloseButton() const OVERRIDE;
virtual View* GetContentsView() OVERRIDE; virtual View* GetContentsView() OVERRIDE;
virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE;
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
// WidgetObserver overrides: // WidgetObserver overrides:
virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; virtual void OnWidgetDestroying(Widget* widget) 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