Commit 6fec1d16 authored by dtseng's avatar dtseng Committed by Commit bot

Reland: Add an event to notify accessibility when a permissions bubble gets shown.

BUG=381338,474622
TEST=ctrl+alt+z; navigate to html5demos.com/geo; observe speech is as expected (reads contents of bubble).

Committed: https://crrev.com/36318aa45e02cf0b5cf871bf38bbe47f3431cc8d
Cr-Commit-Position: refs/heads/master@{#323982}

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

Cr-Commit-Position: refs/heads/master@{#324148}
parent 801c26a4
......@@ -83,3 +83,13 @@ AutomationPredicate.linebreak = function(first, second) {
return fl.top != sl.top ||
(fl.top + fl.height != sl.top + sl.height);
};
/**
* Leaf nodes that should be ignored.
* @param {chrome.automation.AutomationNode} node
* @return {boolean}
*/
AutomationPredicate.shouldIgnoreLeaf = function(node) {
return AutomationPredicate.leaf(node) &&
node.role == chrome.automation.RoleType.client;
};
......@@ -113,6 +113,8 @@ AutomationUtil.findNextNode = function(cur, dir, pred) {
return null;
cur = next;
next = AutomationUtil.findNodePre(next, dir, pred);
if (next && AutomationPredicate.shouldIgnoreLeaf(next))
next = null;
} while (!next);
return next;
};
......
......@@ -195,7 +195,7 @@ Output.RULES = {
speak: '@describe_slider($value, $name)'
},
staticText: {
speak: '$value'
speak: '$value $name'
},
tab: {
speak: '@describe_tab($name)'
......
......@@ -167,6 +167,7 @@ class PermissionsBubbleDelegateView : public views::BubbleDelegateView,
const gfx::FontList& GetTitleFontList() const override;
base::string16 GetWindowTitle() const override;
void OnWidgetDestroying(views::Widget* widget) override;
void GetAccessibleState(ui::AXViewState* state) override;
// ButtonListener:
void ButtonPressed(views::Button* button, const ui::Event& event) override;
......@@ -349,6 +350,11 @@ void PermissionsBubbleDelegateView::OnWidgetDestroying(views::Widget* widget) {
}
}
void PermissionsBubbleDelegateView::GetAccessibleState(ui::AXViewState* state) {
views::BubbleDelegateView::GetAccessibleState(state);
state->role = ui::AX_ROLE_ALERT_DIALOG;
}
void PermissionsBubbleDelegateView::ButtonPressed(views::Button* button,
const ui::Event& event) {
if (!owner_)
......
......@@ -305,6 +305,17 @@ void BubbleDelegateView::HandleVisibilityChanged(Widget* widget, bool visible) {
else
anchor_widget()->GetTopLevelWidget()->EnableInactiveRendering();
}
// Fire AX_EVENT_ALERT for bubbles marked as AX_ROLE_ALERT_DIALOG; this
// instructs accessibility tools to read the bubble in its entirety rather
// than just its title and initially focused view. See
// http://crbug.com/474622 for details.
if (widget == GetWidget() && visible) {
ui::AXViewState state;
GetAccessibleState(&state);
if (state.role == ui::AX_ROLE_ALERT_DIALOG)
NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
}
}
} // namespace views
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