Skip to content

Commit

Permalink
Merge r176076 - AX: [ATK] Accessible focus events are emitted when th…
Browse files Browse the repository at this point in the history
…e selection is changed in non-focused combo boxes

https://bugs.webkit.org/show_bug.cgi?id=137866

Reviewed by Mario Sanchez Prada.

Source/WebCore:

Check that the AccessibilityMenuList is really focused before notifying
the platform that it is focused. Likewise, only notify the platform of
an AccessibilityMenuListOption focus gain if the AccessibilityMenuList
containing that option is expanded.

Test: platform/gtk/accessibility/menu-list-unfocused-notifications.html

* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::notifyChildrenSelectionChange):
(WebCore::AXObjectCache::postPlatformNotification):

LayoutTests:

* platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt: Added.
* platform/gtk/accessibility/menu-list-unfocused-notifications.html: Added.

Canonical link: https://commits.webkit.org/154760.198@webkitgtk/2.6
git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@176177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
joanmarie authored and carlosgcampos committed Nov 17, 2014
1 parent 6568937 commit c6cefc4
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 3 deletions.
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
2014-11-13 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] Accessible focus events are emitted when the selection is changed in non-focused combo boxes
https://bugs.webkit.org/show_bug.cgi?id=137866

Reviewed by Mario Sanchez Prada.

* platform/gtk/accessibility/menu-list-unfocused-notifications-expected.txt: Added.
* platform/gtk/accessibility/menu-list-unfocused-notifications.html: Added.

2014-11-06 Mark Lam <mark.lam@apple.com>

slow_path_get_direct_pname() needs to be hardened against a constant baseValue.
Expand Down
@@ -0,0 +1,24 @@
OK
This tests that changing the selection in a non-focused combo box doesn't result in erroneous focus claims.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


Changing focus to button.
AXFocusedUIElementChanged: AXRole: AXButton
Focused element is: AXRole: AXButton

Changing selected item in non-focused combobox.
AXSelectedChildrenChanged: AXRole: AXComboBox
Focused element is: AXRole: AXButton

Changing selected item in non-focused combobox.
AXSelectedChildrenChanged: AXRole: AXComboBox
Focused element is: AXRole: AXButton

AXChildrenAdded: AXRole: AXWebArea
AXLoadComplete: AXRole: AXWebArea
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,49 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>
<select id="combobox">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
<option value="4">four</option>
</select>
<button id="button">OK</button>
<p id="description"></p>
<div id="console"></div>
<script>
window.jsTestIsAsync = true;
description("This tests that changing the selection in a non-focused combo box doesn't result in erroneous focus claims.");

if (window.testRunner && window.accessibilityController) {
accessibilityController.addNotificationListener(function(element, notification) {
debug(notification + ": " + element.role);
});

debug("Changing focus to button.");
document.getElementById('button').focus();
debug("Focused element is: " + accessibilityController.focusedElement.role + "\n");

// Programmatic selection changes in the non-focused combo box do not result
// in the button losing focus. Therefore the combo box should not claim focus.
debug("Changing selected item in non-focused combobox.");
document.getElementById('combobox').selectedIndex = 3;
debug("Focused element is: " + accessibilityController.focusedElement.role + "\n");

// Programmatic selection changes in the non-focused combo box do not result
// in the button losing focus. Therefore the combo box should not claim focus.
debug("Changing selected item in non-focused combobox.");
document.getElementById('combobox').selectedIndex = 2;
debug("Focused element is: " + accessibilityController.focusedElement.role + "\n");

window.setTimeout(function() {
accessibilityController.removeNotificationListener();
finishJSTest();
}, 0);
}
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
2014-11-13 Joanmarie Diggs <jdiggs@igalia.com>

AX: [ATK] Accessible focus events are emitted when the selection is changed in non-focused combo boxes
https://bugs.webkit.org/show_bug.cgi?id=137866

Reviewed by Mario Sanchez Prada.

Check that the AccessibilityMenuList is really focused before notifying
the platform that it is focused. Likewise, only notify the platform of
an AccessibilityMenuListOption focus gain if the AccessibilityMenuList
containing that option is expanded.

Test: platform/gtk/accessibility/menu-list-unfocused-notifications.html

* accessibility/atk/AXObjectCacheAtk.cpp:
(WebCore::notifyChildrenSelectionChange):
(WebCore::AXObjectCache::postPlatformNotification):

2014-11-11 David Kilzer <ddkilzer@apple.com>

Protect Document in ProcessingInstruction::setXSLStyleSheet()
Expand Down
11 changes: 8 additions & 3 deletions Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
Expand Up @@ -175,8 +175,12 @@ static void notifyChildrenSelectionChange(AccessibilityObject* object)
if (axItem) {
bool isSelected = item->isSelected();
atk_object_notify_state_change(axItem, ATK_STATE_SELECTED, isSelected);
g_signal_emit_by_name(axItem, "focus-event", isSelected);
atk_object_notify_state_change(axItem, ATK_STATE_FOCUSED, isSelected);
// When the selection changes in a collapsed widget such as a combo box
// whose child menu is not showing, that collapsed widget retains focus.
if (!object->isCollapsed()) {
g_signal_emit_by_name(axItem, "focus-event", isSelected);
atk_object_notify_state_change(axItem, ATK_STATE_FOCUSED, isSelected);
}
}

// Update pointers to the previously involved objects.
Expand All @@ -199,7 +203,8 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, AX

case AXSelectedChildrenChanged:
case AXMenuListValueChanged:
if (notification == AXMenuListValueChanged && coreObject->isMenuList()) {
// Accessible focus claims should not be made if the associated widget is not focused.
if (notification == AXMenuListValueChanged && coreObject->isMenuList() && coreObject->isFocused()) {
g_signal_emit_by_name(axObject, "focus-event", true);
atk_object_notify_state_change(axObject, ATK_STATE_FOCUSED, true);
}
Expand Down

0 comments on commit c6cefc4

Please sign in to comment.