Commit 81ecb5a7 authored by benwells's avatar benwells Committed by Commit bot

Improve accessibility for the bookmark app bubble.

This change sets the accessibility state of the bubble correctly, and
also adds an accessible name for the name edit.

The question mark is also removed from the bubble title.

BUG=363372

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

Cr-Commit-Position: refs/heads/master@{#316636}
parent 46e291af
......@@ -2190,10 +2190,19 @@ Even if you have downloaded files from this website before, the website might ha
</message>
<!-- Bookmark app bubble -->
<message name="IDS_BOOKMARK_APP_BUBBLE_TITLE" desc="Title of the bubble to add a bookmark app.">
Add shortcut?
<if expr="use_titlecase">
<message name="IDS_BOOKMARK_APP_BUBBLE_TITLE" desc="Title of the bubble to add a bookmark app.">
Add Shortcut
</message>
</if>
<if expr="not use_titlecase">
<message name="IDS_BOOKMARK_APP_BUBBLE_TITLE" desc="Title of the bubble to add a bookmark app.">
Add shortcut
</message>
</if>
<message name="IDS_BOOKMARK_APP_AX_BUBBLE_NAME_LABEL" desc="Text preceding the name of a bookmark app, read by spoken feedback.">
Shortcut name
</message>
<message name="IDS_BOOKMARK_APP_BUBBLE_OPEN_AS_WINDOW" desc="Checkbox text for opening the bookmark app as a window.">
Open as window
</message>
......
......@@ -10,6 +10,7 @@
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/constants.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/keycodes/keyboard_codes.h"
......@@ -179,6 +180,8 @@ void BookmarkAppBubbleView::Init() {
title_tf_ = new views::Textfield();
title_tf_->SetText(web_app_info_.title);
title_tf_->SetAccessibleName(l10n_util::GetStringUTF16(
IDS_BOOKMARK_APP_AX_BUBBLE_NAME_LABEL));
title_tf_->set_controller(this);
layout->AddView(title_tf_);
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
......@@ -213,6 +216,11 @@ bool BookmarkAppBubbleView::AcceleratorPressed(
return BubbleDelegateView::AcceleratorPressed(accelerator);
}
void BookmarkAppBubbleView::GetAccessibleState(ui::AXViewState* state) {
views::BubbleDelegateView::GetAccessibleState(state);
state->name = l10n_util::GetStringUTF16(IDS_BOOKMARK_APP_BUBBLE_TITLE);
}
gfx::Size BookmarkAppBubbleView::GetMinimumSize() const {
gfx::Size size(views::BubbleDelegateView::GetPreferredSize());
size.SetToMax(gfx::Size(kMinBubbleWidth, 0));
......
......@@ -55,6 +55,7 @@ class BookmarkAppBubbleView : public views::BubbleDelegateView,
// Overridden from views::View:
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
void GetAccessibleState(ui::AXViewState* state) override;
gfx::Size GetMinimumSize() const override;
// Overridden from views::ButtonListener:
......
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