Commit ffc377fd authored by Adam Ettenberger's avatar Adam Ettenberger Committed by Commit Bot

Fire UIA SelectionItem events on aria-checked changes for radio buttons

According to the following spec radio and menuitemradio should expose
UIA SelectedItem.IsSelected when aria-checked is set :
https://www.w3.org/TR/core-aam-1.1/#mapping_state-property_table

This CL ensures that radio / menuitemradio fire appropriate
SelectionItem events, and whenever a SelectionItem changes its
selection state that we also fire a Property Changed event for
SelectionItem.IsSelected.

AX-Relnotes: Fire missing events for ARIA radio/menuitemradio when aria-checked changes. Narrator will now announce selected state changes for this scenario.
Bug: 1102580
Change-Id: I72f479e25f61b0ddffc28f73d4a9c34e8dc4ecb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212982Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Adam Ettenberger <Adam.Ettenberger@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#791802}
parent 44f37823
...@@ -157,6 +157,13 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent( ...@@ -157,6 +157,13 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent(
aria_properties_events_.insert(node); aria_properties_events_.insert(node);
break; break;
case ui::AXEventGenerator::Event::CHECKED_STATE_CHANGED: case ui::AXEventGenerator::Event::CHECKED_STATE_CHANGED:
// https://www.w3.org/TR/core-aam-1.1/#mapping_state-property_table
// SelectionItem.IsSelected is set according to the True or False value of
// aria-checked for 'radio' and 'menuitemradio' roles.
if (ui::IsRadio(node->GetRole())) {
HandleSelectedStateChanged(uia_selection_events_, node,
IsUIANodeSelected(node));
}
FireUiaPropertyChangedEvent(UIA_ToggleToggleStatePropertyId, node); FireUiaPropertyChangedEvent(UIA_ToggleToggleStatePropertyId, node);
aria_properties_events_.insert(node); aria_properties_events_.insert(node);
break; break;
...@@ -328,7 +335,10 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent( ...@@ -328,7 +335,10 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent(
node); node);
break; break;
case ui::AXEventGenerator::Event::SELECTED_CHANGED: case ui::AXEventGenerator::Event::SELECTED_CHANGED:
HandleSelectedStateChanged(node); HandleSelectedStateChanged(ia2_selection_events_, node,
IsIA2NodeSelected(node));
HandleSelectedStateChanged(uia_selection_events_, node,
IsUIANodeSelected(node));
aria_properties_events_.insert(node); aria_properties_events_.insert(node);
break; break;
case ui::AXEventGenerator::Event::SELECTED_CHILDREN_CHANGED: case ui::AXEventGenerator::Event::SELECTED_CHILDREN_CHANGED:
...@@ -646,34 +656,144 @@ void BrowserAccessibilityManagerWin::OnAtomicUpdateFinished( ...@@ -646,34 +656,144 @@ void BrowserAccessibilityManagerWin::OnAtomicUpdateFinished(
} }
} }
void BrowserAccessibilityManagerWin::HandleSelectedStateChanged( // static
bool BrowserAccessibilityManagerWin::IsIA2NodeSelected(
BrowserAccessibility* node) { BrowserAccessibility* node) {
const bool is_selected = return node->GetBoolAttribute(ax::mojom::BoolAttribute::kSelected);
node->GetBoolAttribute(ax::mojom::BoolAttribute::kSelected); }
// Nodes that have selection container may support multiselect, for such nodes // static
// we add them to |selection_events_|, which FinalizeAccessibilityEvents bool BrowserAccessibilityManagerWin::IsUIANodeSelected(
// handles selection item events firing. BrowserAccessibility* node) {
// For nodes that do not have selection container, only single select is // https://www.w3.org/TR/core-aam-1.1/#mapping_state-property_table
// supported, selection item events firing are handled here. // SelectionItem.IsSelected is set according to the True or False value of
if (auto* selection_container = node->PlatformGetSelectionContainer()) { // aria-checked for 'radio' and 'menuitemradio' roles.
if (is_selected) { if (ui::IsRadio(node->GetRole()))
selection_events_[selection_container].added.push_back(node); return node->GetData().GetCheckedState() == ax::mojom::CheckedState::kTrue;
} else {
selection_events_[selection_container].removed.push_back(node); return node->GetBoolAttribute(ax::mojom::BoolAttribute::kSelected);
}
void BrowserAccessibilityManagerWin::FireIA2SelectionEvents(
BrowserAccessibility* container,
BrowserAccessibility* only_selected_child,
const SelectionEvents& changes) {
if (only_selected_child) {
// Fire 'ElementSelected' on the only selected child.
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTION, only_selected_child);
} else {
const bool container_is_multiselectable =
container && container->HasState(ax::mojom::State::kMultiselectable);
for (auto* item : changes.added) {
if (container_is_multiselectable)
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTIONADD, item);
else
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTION, item);
} }
for (auto* item : changes.removed)
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTIONREMOVE, item);
}
}
void BrowserAccessibilityManagerWin::FireUIASelectionEvents(
BrowserAccessibility* container,
BrowserAccessibility* only_selected_child,
const SelectionEvents& changes) {
if (only_selected_child) {
// Fire 'ElementSelected' on the only selected child.
FireUiaAccessibilityEvent(UIA_SelectionItem_ElementSelectedEventId,
only_selected_child);
FireUiaPropertyChangedEvent(UIA_SelectionItemIsSelectedPropertyId,
only_selected_child);
for (auto* item : changes.removed)
FireUiaPropertyChangedEvent(UIA_SelectionItemIsSelectedPropertyId, item);
} else { } else {
if (is_selected) { // Per UIA documentation, beyond the "invalidate limit" we're supposed to
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTION, node); // fire a 'SelectionInvalidated' event. The exact value isn't specified,
FireUiaAccessibilityEvent(UIA_SelectionItem_ElementSelectedEventId, node); // but System.Windows.Automation.Provider uses a value of 20.
static const size_t kInvalidateLimit = 20;
if ((changes.added.size() + changes.removed.size()) > kInvalidateLimit) {
DCHECK_NE(container, nullptr);
FireUiaAccessibilityEvent(UIA_Selection_InvalidatedEventId, container);
} else { } else {
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTIONREMOVE, node); const bool container_is_multiselectable =
FireUiaAccessibilityEvent( container && container->HasState(ax::mojom::State::kMultiselectable);
UIA_SelectionItem_ElementRemovedFromSelectionEventId, node); for (auto* item : changes.added) {
if (container_is_multiselectable) {
FireUiaAccessibilityEvent(
UIA_SelectionItem_ElementAddedToSelectionEventId, item);
} else {
FireUiaAccessibilityEvent(UIA_SelectionItem_ElementSelectedEventId,
item);
}
FireUiaPropertyChangedEvent(UIA_SelectionItemIsSelectedPropertyId,
item);
}
for (auto* item : changes.removed) {
FireUiaAccessibilityEvent(
UIA_SelectionItem_ElementRemovedFromSelectionEventId, item);
FireUiaPropertyChangedEvent(UIA_SelectionItemIsSelectedPropertyId,
item);
}
} }
} }
} }
// static
void BrowserAccessibilityManagerWin::HandleSelectedStateChanged(
SelectionEventsMap& selection_events_map,
BrowserAccessibility* node,
bool is_selected) {
// If |node| belongs to a selection container, then map the events with the
// selection container as the key because |FinalizeSelectionEvents| needs to
// determine whether or not there is only one element selected in order to
// optimize what platform events are sent.
BrowserAccessibility* key = node;
if (auto* selection_container = node->PlatformGetSelectionContainer())
key = selection_container;
if (is_selected)
selection_events_map[key].added.push_back(node);
else
selection_events_map[key].removed.push_back(node);
}
// static
void BrowserAccessibilityManagerWin::FinalizeSelectionEvents(
SelectionEventsMap& selection_events_map,
IsSelectedPredicate is_selected_predicate,
FirePlatformSelectionEventsCallback fire_platform_events_callback) {
for (auto&& selected : selection_events_map) {
BrowserAccessibility* key_node = selected.first;
SelectionEvents& changes = selected.second;
// Determine if |node| is a selection container with one selected child in
// order to optimize what platform events are sent.
BrowserAccessibility* container = nullptr;
BrowserAccessibility* only_selected_child = nullptr;
if (ui::IsContainerWithSelectableChildren(key_node->GetRole())) {
container = key_node;
for (auto it = container->InternalChildrenBegin();
it != container->InternalChildrenEnd(); ++it) {
auto* child = it.get();
if (is_selected_predicate.Run(child)) {
if (!only_selected_child) {
only_selected_child = child;
continue;
}
only_selected_child = nullptr;
break;
}
}
}
fire_platform_events_callback.Run(container, only_selected_child, changes);
}
selection_events_map.clear();
}
void BrowserAccessibilityManagerWin::BeforeAccessibilityEvents() { void BrowserAccessibilityManagerWin::BeforeAccessibilityEvents() {
BrowserAccessibilityManager::BeforeAccessibilityEvents(); BrowserAccessibilityManager::BeforeAccessibilityEvents();
...@@ -710,56 +830,17 @@ void BrowserAccessibilityManagerWin::FinalizeAccessibilityEvents() { ...@@ -710,56 +830,17 @@ void BrowserAccessibilityManagerWin::FinalizeAccessibilityEvents() {
text_selection_changed_events_.clear(); text_selection_changed_events_.clear();
// Finalize selection item events. // Finalize selection item events.
for (auto&& selected : selection_events_) { FinalizeSelectionEvents(
auto* container = selected.first; ia2_selection_events_, base::BindRepeating(&IsIA2NodeSelected),
auto&& changes = selected.second; base::BindRepeating(
&BrowserAccessibilityManagerWin::FireIA2SelectionEvents,
// Count the number of selected items base::Unretained(this)));
size_t selected_count = 0; FinalizeSelectionEvents(
BrowserAccessibility* first_selected_child = nullptr; uia_selection_events_, base::BindRepeating(&IsUIANodeSelected),
for (auto it = container->InternalChildrenBegin(); base::BindRepeating(
it != container->InternalChildrenEnd(); ++it) { &BrowserAccessibilityManagerWin::FireUIASelectionEvents,
auto* child = it.get(); base::Unretained(this)));
if (child->GetBoolAttribute(ax::mojom::BoolAttribute::kSelected)) {
if (!first_selected_child)
first_selected_child = child;
selected_count++;
}
}
if (selected_count == 1) {
// Fire 'ElementSelected' on the only selected child
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTION, first_selected_child);
FireUiaAccessibilityEvent(UIA_SelectionItem_ElementSelectedEventId,
first_selected_child);
} else {
// Per UIA documentation, beyond the "invalidate limit" we're supposed to
// fire a 'SelectionInvalidated' event. The exact value isn't specified,
// but System.Windows.Automation.Provider uses a value of 20.
static const size_t kInvalidateLimit = 20;
if ((changes.added.size() + changes.removed.size()) > kInvalidateLimit) {
FireUiaAccessibilityEvent(UIA_Selection_InvalidatedEventId, container);
} else {
for (auto* item : changes.added) {
if (container->HasState(ax::mojom::State::kMultiselectable)) {
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTIONADD, item);
FireUiaAccessibilityEvent(
UIA_SelectionItem_ElementAddedToSelectionEventId, item);
} else {
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTION, item);
FireUiaAccessibilityEvent(UIA_SelectionItem_ElementSelectedEventId,
item);
}
}
for (auto* item : changes.removed) {
FireWinAccessibilityEvent(EVENT_OBJECT_SELECTIONREMOVE, item);
FireUiaAccessibilityEvent(
UIA_SelectionItem_ElementRemovedFromSelectionEventId, item);
}
}
}
}
selection_events_.clear();
ignored_changed_nodes_.clear(); ignored_changed_nodes_.clear();
} }
......
...@@ -77,7 +77,40 @@ class CONTENT_EXPORT BrowserAccessibilityManagerWin ...@@ -77,7 +77,40 @@ class CONTENT_EXPORT BrowserAccessibilityManagerWin
const std::vector<ui::AXTreeObserver::Change>& changes) override; const std::vector<ui::AXTreeObserver::Change>& changes) override;
private: private:
void HandleSelectedStateChanged(BrowserAccessibility* node); struct SelectionEvents {
std::vector<BrowserAccessibility*> added;
std::vector<BrowserAccessibility*> removed;
SelectionEvents();
~SelectionEvents();
};
using SelectionEventsMap = std::map<BrowserAccessibility*, SelectionEvents>;
using IsSelectedPredicate =
base::RepeatingCallback<bool(BrowserAccessibility*)>;
using FirePlatformSelectionEventsCallback =
base::RepeatingCallback<void(BrowserAccessibility*,
BrowserAccessibility*,
const SelectionEvents&)>;
static bool IsIA2NodeSelected(BrowserAccessibility* node);
static bool IsUIANodeSelected(BrowserAccessibility* node);
void FireIA2SelectionEvents(BrowserAccessibility* container,
BrowserAccessibility* only_selected_child,
const SelectionEvents& changes);
void FireUIASelectionEvents(BrowserAccessibility* container,
BrowserAccessibility* only_selected_child,
const SelectionEvents& changes);
static void HandleSelectedStateChanged(
SelectionEventsMap& selection_events_map,
BrowserAccessibility* node,
bool is_selected);
static void FinalizeSelectionEvents(
SelectionEventsMap& selection_events_map,
IsSelectedPredicate is_selected_predicate,
FirePlatformSelectionEventsCallback fire_platform_events_callback);
// Give BrowserAccessibilityManager::Create access to our constructor. // Give BrowserAccessibilityManager::Create access to our constructor.
friend class BrowserAccessibilityManager; friend class BrowserAccessibilityManager;
...@@ -109,13 +142,8 @@ class CONTENT_EXPORT BrowserAccessibilityManagerWin ...@@ -109,13 +142,8 @@ class CONTENT_EXPORT BrowserAccessibilityManagerWin
// Keep track of selection changes so we can optimize UIA event firing. // Keep track of selection changes so we can optimize UIA event firing.
// Pointers are only stored for the duration of |OnAccessibilityEvents|, and // Pointers are only stored for the duration of |OnAccessibilityEvents|, and
// the map is cleared in |FinalizeAccessibilityEvents|. // the map is cleared in |FinalizeAccessibilityEvents|.
struct SelectionEvents { SelectionEventsMap ia2_selection_events_;
std::vector<BrowserAccessibility*> added; SelectionEventsMap uia_selection_events_;
std::vector<BrowserAccessibility*> removed;
SelectionEvents();
~SelectionEvents();
};
std::map<BrowserAccessibility*, SelectionEvents> selection_events_;
DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin); DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin);
}; };
......
...@@ -2,6 +2,10 @@ AriaProperties changed on role=checkbox, name=checkbox1 ...@@ -2,6 +2,10 @@ AriaProperties changed on role=checkbox, name=checkbox1
AriaProperties changed on role=checkbox, name=checkbox2 AriaProperties changed on role=checkbox, name=checkbox2
AriaProperties changed on role=radio, name=radio1 AriaProperties changed on role=radio, name=radio1
AriaProperties changed on role=radio, name=radio2 AriaProperties changed on role=radio, name=radio2
SelectionItemIsSelected changed on role=radio, name=radio1
SelectionItemIsSelected changed on role=radio, name=radio2
SelectionItem_ElementRemovedFromSelection on role=radio, name=radio2
SelectionItem_ElementSelected on role=radio, name=radio1
ToggleToggleState changed on role=checkbox, name=checkbox1 ToggleToggleState changed on role=checkbox, name=checkbox1
ToggleToggleState changed on role=checkbox, name=checkbox2 ToggleToggleState changed on role=checkbox, name=checkbox2
ToggleToggleState changed on role=radio, name=radio1 ToggleToggleState changed on role=radio, name=radio1
......
...@@ -3,4 +3,5 @@ AriaProperties changed on role=option, name=Apple ...@@ -3,4 +3,5 @@ AriaProperties changed on role=option, name=Apple
AutomationFocusChanged on role=option, name=Apple AutomationFocusChanged on role=option, name=Apple
AutomationFocusChanged on role=option, name=Apple AutomationFocusChanged on role=option, name=Apple
ExpandCollapseExpandCollapseState changed on role=combobox ExpandCollapseExpandCollapseState changed on role=combobox
SelectionItemIsSelected changed on role=option, name=Apple
SelectionItem_ElementSelected on role=option, name=Apple SelectionItem_ElementSelected on role=option, name=Apple
...@@ -4,4 +4,5 @@ AutomationFocusChanged on role=combobox ...@@ -4,4 +4,5 @@ AutomationFocusChanged on role=combobox
AutomationFocusChanged on role=option, name=Apple AutomationFocusChanged on role=option, name=Apple
AutomationFocusChanged on role=option, name=Apple AutomationFocusChanged on role=option, name=Apple
ExpandCollapseExpandCollapseState changed on role=combobox ExpandCollapseExpandCollapseState changed on role=combobox
SelectionItemIsSelected changed on role=option, name=Apple
SelectionItem_ElementSelected on role=option, name=Apple SelectionItem_ElementSelected on role=option, name=Apple
...@@ -2,10 +2,14 @@ AriaProperties changed on role=option, name=Apple ...@@ -2,10 +2,14 @@ AriaProperties changed on role=option, name=Apple
AriaProperties changed on role=option, name=Orange AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
SelectionItemIsSelected changed on role=option, name=Apple
SelectionItemIsSelected changed on role=option, name=Orange
SelectionItem_ElementSelected on role=option, name=Orange SelectionItem_ElementSelected on role=option, name=Orange
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=option, name=Banana AriaProperties changed on role=option, name=Banana
AriaProperties changed on role=option, name=Orange AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Banana AutomationFocusChanged on role=option, name=Banana
AutomationFocusChanged on role=option, name=Banana AutomationFocusChanged on role=option, name=Banana
SelectionItemIsSelected changed on role=option, name=Banana
SelectionItemIsSelected changed on role=option, name=Orange
SelectionItem_ElementSelected on role=option, name=Banana SelectionItem_ElementSelected on role=option, name=Banana
...@@ -3,6 +3,7 @@ AriaProperties changed on role=option, name=Orange ...@@ -3,6 +3,7 @@ AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Apple AutomationFocusChanged on role=option, name=Apple
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
SelectionItemIsSelected changed on role=option, name=Orange
SelectionItem_ElementSelected on role=option, name=Orange SelectionItem_ElementSelected on role=option, name=Orange
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=option, name=Banana AriaProperties changed on role=option, name=Banana
...@@ -10,4 +11,5 @@ AriaProperties changed on role=option, name=Orange ...@@ -10,4 +11,5 @@ AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Banana AutomationFocusChanged on role=option, name=Banana
AutomationFocusChanged on role=option, name=Banana AutomationFocusChanged on role=option, name=Banana
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
SelectionItemIsSelected changed on role=option, name=Banana
SelectionItem_ElementSelected on role=option, name=Banana SelectionItem_ElementSelected on role=option, name=Banana
AriaProperties changed on role=gridcell, name=Grid1, GridCell1 AriaProperties changed on role=gridcell, name=Grid1, GridCell1
SelectionItemIsSelected changed on role=gridcell, name=Grid1, GridCell1
SelectionItem_ElementRemovedFromSelection on role=gridcell, name=Grid1, GridCell1 SelectionItem_ElementRemovedFromSelection on role=gridcell, name=Grid1, GridCell1
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=gridcell, name=Grid2, GridCell2 AriaProperties changed on role=gridcell, name=Grid2, GridCell2
SelectionItemIsSelected changed on role=gridcell, name=Grid2, GridCell2
SelectionItem_ElementAddedToSelection on role=gridcell, name=Grid2, GridCell2 SelectionItem_ElementAddedToSelection on role=gridcell, name=Grid2, GridCell2
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=gridcell, name=Grid3, GridCell1 AriaProperties changed on role=gridcell, name=Grid3, GridCell1
SelectionItemIsSelected changed on role=gridcell, name=Grid3, GridCell1
SelectionItem_ElementRemovedFromSelection on role=gridcell, name=Grid3, GridCell1 SelectionItem_ElementRemovedFromSelection on role=gridcell, name=Grid3, GridCell1
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=gridcell, name=Grid4, GridCell1 AriaProperties changed on role=gridcell, name=Grid4, GridCell1
AriaProperties changed on role=gridcell, name=Grid4, GridCell2 AriaProperties changed on role=gridcell, name=Grid4, GridCell2
SelectionItemIsSelected changed on role=gridcell, name=Grid4, GridCell1
SelectionItemIsSelected changed on role=gridcell, name=Grid4, GridCell2
SelectionItem_ElementRemovedFromSelection on role=gridcell, name=Grid4, GridCell1 SelectionItem_ElementRemovedFromSelection on role=gridcell, name=Grid4, GridCell1
SelectionItem_ElementSelected on role=gridcell, name=Grid4, GridCell2 SelectionItem_ElementSelected on role=gridcell, name=Grid4, GridCell2
=== Start Continuation === === Start Continuation ===
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=combobox AriaProperties changed on role=combobox
AriaProperties changed on role=listitem, name=Select2, Option2 AriaProperties changed on role=listitem, name=Select2, Option2
SelectionItemIsSelected changed on role=combobox
SelectionItemIsSelected changed on role=listitem, name=Select2, Option2
SelectionItem_ElementSelected on role=listitem, name=Select2, Option2 SelectionItem_ElementSelected on role=listitem, name=Select2, Option2
ValueValue changed on role=combobox ValueValue changed on role=combobox
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=option, name=DivSelect, Option1 AriaProperties changed on role=option, name=DivSelect, Option1
AriaProperties changed on role=option, name=DivSelect, Option2 AriaProperties changed on role=option, name=DivSelect, Option2
SelectionItemIsSelected changed on role=option, name=DivSelect, Option1
SelectionItemIsSelected changed on role=option, name=DivSelect, Option2
SelectionItem_ElementSelected on role=option, name=DivSelect, Option2 SelectionItem_ElementSelected on role=option, name=DivSelect, Option2
...@@ -2,4 +2,6 @@ AriaProperties changed on role=option, name=b ...@@ -2,4 +2,6 @@ AriaProperties changed on role=option, name=b
AriaProperties changed on role=option, name=c AriaProperties changed on role=option, name=c
AutomationFocusChanged on role=option, name=c AutomationFocusChanged on role=option, name=c
AutomationFocusChanged on role=option, name=c AutomationFocusChanged on role=option, name=c
SelectionItemIsSelected changed on role=option, name=b
SelectionItemIsSelected changed on role=option, name=c
SelectionItem_ElementSelected on role=option, name=c SelectionItem_ElementSelected on role=option, name=c
...@@ -2,4 +2,6 @@ AriaProperties changed on role=option, name=Apple ...@@ -2,4 +2,6 @@ AriaProperties changed on role=option, name=Apple
AriaProperties changed on role=option, name=Orange AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
SelectionItemIsSelected changed on role=option, name=Apple
SelectionItemIsSelected changed on role=option, name=Orange
SelectionItem_ElementSelected on role=option, name=Orange SelectionItem_ElementSelected on role=option, name=Orange
...@@ -3,4 +3,5 @@ AriaProperties changed on role=option, name=Orange ...@@ -3,4 +3,5 @@ AriaProperties changed on role=option, name=Orange
AutomationFocusChanged on role=option, name=Apple AutomationFocusChanged on role=option, name=Apple
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
AutomationFocusChanged on role=option, name=Orange AutomationFocusChanged on role=option, name=Orange
SelectionItemIsSelected changed on role=option, name=Orange
SelectionItem_ElementSelected on role=option, name=Orange SelectionItem_ElementSelected on role=option, name=Orange
...@@ -2,5 +2,6 @@ AutomationFocusChanged on role=combobox ...@@ -2,5 +2,6 @@ AutomationFocusChanged on role=combobox
AutomationFocusChanged on role=combobox AutomationFocusChanged on role=combobox
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=combobox AriaProperties changed on role=combobox
SelectionItemIsSelected changed on role=combobox
SelectionItem_ElementRemovedFromSelection on role=combobox SelectionItem_ElementRemovedFromSelection on role=combobox
ValueValue changed on role=combobox ValueValue changed on role=combobox
...@@ -3,5 +3,6 @@ AutomationFocusChanged on role=combobox ...@@ -3,5 +3,6 @@ AutomationFocusChanged on role=combobox
AutomationFocusChanged on role=combobox AutomationFocusChanged on role=combobox
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=combobox AriaProperties changed on role=combobox
SelectionItemIsSelected changed on role=combobox
SelectionItem_ElementRemovedFromSelection on role=combobox SelectionItem_ElementRemovedFromSelection on role=combobox
ValueValue changed on role=combobox ValueValue changed on role=combobox
...@@ -3,5 +3,7 @@ AutomationFocusChanged on role=combobox ...@@ -3,5 +3,7 @@ AutomationFocusChanged on role=combobox
=== Start Continuation === === Start Continuation ===
AriaProperties changed on role=combobox AriaProperties changed on role=combobox
AriaProperties changed on role=listitem, name=Orange AriaProperties changed on role=listitem, name=Orange
SelectionItemIsSelected changed on role=combobox
SelectionItemIsSelected changed on role=listitem, name=Orange
SelectionItem_ElementSelected on role=listitem, name=Orange SelectionItem_ElementSelected on role=listitem, name=Orange
ValueValue changed on role=combobox ValueValue changed on role=combobox
...@@ -5,5 +5,6 @@ AutomationFocusChanged on role=combobox ...@@ -5,5 +5,6 @@ AutomationFocusChanged on role=combobox
AriaProperties changed on role=combobox AriaProperties changed on role=combobox
AriaProperties changed on role=listitem, name=Orange AriaProperties changed on role=listitem, name=Orange
AutomationFocusChanged on role=combobox AutomationFocusChanged on role=combobox
SelectionItemIsSelected changed on role=listitem, name=Orange
SelectionItem_ElementSelected on role=listitem, name=Orange SelectionItem_ElementSelected on role=listitem, name=Orange
ValueValue changed on role=combobox ValueValue changed on role=combobox
SelectionItemIsSelected changed on role=option, name=Option2
SelectionItem_ElementSelected on role=option, name=Option2 SelectionItem_ElementSelected on role=option, name=Option2
=== Start Continuation === === Start Continuation ===
SelectionItemIsSelected changed on role=option, name=Option3
SelectionItem_ElementAddedToSelection on role=option, name=Option3 SelectionItem_ElementAddedToSelection on role=option, name=Option3
=== Start Continuation === === Start Continuation ===
SelectionItemIsSelected changed on role=option, name=Option4
SelectionItem_ElementRemovedFromSelection on role=option, name=Option4 SelectionItem_ElementRemovedFromSelection on role=option, name=Option4
=== Start Continuation === === Start Continuation ===
SelectionItemIsSelected changed on role=option, name=Option5
SelectionItemIsSelected changed on role=option, name=Option6
SelectionItem_ElementSelected on role=option, name=Option6 SelectionItem_ElementSelected on role=option, name=Option6
=== Start Continuation === === Start Continuation ===
SelectionItemIsSelected changed on role=combobox, name=Combo3
SelectionItemIsSelected changed on role=listitem, name=Option8
SelectionItem_ElementSelected on role=listitem, name=Option8 SelectionItem_ElementSelected on role=listitem, name=Option8
=== Start Continuation === === Start Continuation ===
Selection_Invalidated on role=listbox, name=Combo4 Selection_Invalidated on role=listbox, name=Combo4
<!-- <!--
@UIA-WIN-DENY:* @UIA-WIN-DENY:*
@UIA-WIN-ALLOW:SelectionItem_Element* @UIA-WIN-ALLOW:SelectionItem_Element*
@UIA-WIN-ALLOW:SelectionItemIsSelected*
@UIA-WIN-ALLOW:Selection_Invalidated* @UIA-WIN-ALLOW:Selection_Invalidated*
--> -->
<!DOCTYPE html> <!DOCTYPE html>
......
...@@ -403,6 +403,16 @@ bool IsPresentational(const ax::mojom::Role role) { ...@@ -403,6 +403,16 @@ bool IsPresentational(const ax::mojom::Role role) {
} }
} }
bool IsRadio(const ax::mojom::Role role) {
switch (role) {
case ax::mojom::Role::kRadioButton:
case ax::mojom::Role::kMenuItemRadio:
return true;
default:
return false;
}
}
bool IsRangeValueSupported(const ax::mojom::Role role) { bool IsRangeValueSupported(const ax::mojom::Role role) {
// https://www.w3.org/TR/wai-aria-1.1/#aria-valuenow // https://www.w3.org/TR/wai-aria-1.1/#aria-valuenow
// https://www.w3.org/TR/wai-aria-1.1/#aria-valuetext // https://www.w3.org/TR/wai-aria-1.1/#aria-valuetext
......
...@@ -113,6 +113,9 @@ AX_BASE_EXPORT bool IsMenuRelated(const ax::mojom::Role role); ...@@ -113,6 +113,9 @@ AX_BASE_EXPORT bool IsMenuRelated(const ax::mojom::Role role);
// API. // API.
AX_BASE_EXPORT bool IsPresentational(const ax::mojom::Role role); AX_BASE_EXPORT bool IsPresentational(const ax::mojom::Role role);
// Returns true if the provided role belongs to a radio.
AX_BASE_EXPORT bool IsRadio(const ax::mojom::Role role);
// Returns true if the provided role supports a range-based value, such as a // Returns true if the provided role supports a range-based value, such as a
// slider. // slider.
AX_BASE_EXPORT bool IsRangeValueSupported(const ax::mojom::Role role); AX_BASE_EXPORT bool IsRangeValueSupported(const ax::mojom::Role role);
......
...@@ -7588,6 +7588,10 @@ base::Optional<PROPERTYID> AXPlatformNodeWin::MojoEventToUIAProperty( ...@@ -7588,6 +7588,10 @@ base::Optional<PROPERTYID> AXPlatformNodeWin::MojoEventToUIAProperty(
case ax::mojom::Event::kRowCollapsed: case ax::mojom::Event::kRowCollapsed:
case ax::mojom::Event::kRowExpanded: case ax::mojom::Event::kRowExpanded:
return UIA_ExpandCollapseExpandCollapseStatePropertyId; return UIA_ExpandCollapseExpandCollapseStatePropertyId;
case ax::mojom::Event::kSelection:
case ax::mojom::Event::kSelectionAdd:
case ax::mojom::Event::kSelectionRemove:
return UIA_SelectionItemIsSelectedPropertyId;
default: default:
return base::nullopt; return base::nullopt;
} }
......
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