Title: [233257] trunk
Revision
233257
Author
n_w...@apple.com
Date
2018-06-27 09:10:21 -0700 (Wed, 27 Jun 2018)

Log Message

AX: [iOS] Remove the ability to set keyboard focus when VoiceOver takes focus
https://bugs.webkit.org/show_bug.cgi?id=187076

Reviewed by Chris Fleizach.

Source/WebCore:

We shouldn't set keyboard focus when assistive technology takes focus since
this is causing website incompatibility issues by causing focus to be lost.

Test: accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):

LayoutTests:

* accessibility/ios-simulator/accessibility-focus-do-not-set-focus-expected.txt: Added.
* accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html: Added.
* accessibility/ios-simulator/dom-focus-fires-on-correct-element-expected.txt: Removed.
* accessibility/ios-simulator/dom-focus-fires-on-correct-element.html: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233256 => 233257)


--- trunk/LayoutTests/ChangeLog	2018-06-27 15:14:45 UTC (rev 233256)
+++ trunk/LayoutTests/ChangeLog	2018-06-27 16:10:21 UTC (rev 233257)
@@ -1,3 +1,15 @@
+2018-06-27  Nan Wang  <n_w...@apple.com>
+
+        AX: [iOS] Remove the ability to set keyboard focus when VoiceOver takes focus
+        https://bugs.webkit.org/show_bug.cgi?id=187076
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/ios-simulator/accessibility-focus-do-not-set-focus-expected.txt: Added.
+        * accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html: Added.
+        * accessibility/ios-simulator/dom-focus-fires-on-correct-element-expected.txt: Removed.
+        * accessibility/ios-simulator/dom-focus-fires-on-correct-element.html: Removed.
+
 2018-06-26  Youenn Fablet  <you...@apple.com>
 
         Import wpt CORP tests

Added: trunk/LayoutTests/accessibility/ios-simulator/accessibility-focus-do-not-set-focus-expected.txt (0 => 233257)


--- trunk/LayoutTests/accessibility/ios-simulator/accessibility-focus-do-not-set-focus-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/accessibility-focus-do-not-set-focus-expected.txt	2018-06-27 16:10:21 UTC (rev 233257)
@@ -0,0 +1,12 @@
+focusable
+This tests that accessibilityElementDidBecomeFocused on elements won't set focus.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+received accessiblefocus event
+PASS link === document.activeElement is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html (0 => 233257)


--- trunk/LayoutTests/accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html	2018-06-27 16:10:21 UTC (rev 233257)
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<a id="link" _onaccessiblefocus_="focusEventCallback()" href="" tabIndex="0">focusable</a>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that accessibilityElementDidBecomeFocused on elements won't set focus.");
+
+    var link = document.getElementById("link");
+
+    if (window.accessibilityController) {
+    	jsTestIsAsync = true;
+    
+        var linkAX = accessibilityController.accessibleElementById("link");
+        linkAX.assistiveTechnologySimulatedFocus();
+    }
+
+    // Also make sure we dispatch the accessiblefocus event.
+    function focusEventCallback() {
+        debug("received accessiblefocus event");
+        shouldBeFalse("link === document.activeElement");
+        finishJSTest();
+    }
+    
+</script>
+
+<script src=""
+</body>
+</html>

Deleted: trunk/LayoutTests/accessibility/ios-simulator/dom-focus-fires-on-correct-element-expected.txt (233256 => 233257)


--- trunk/LayoutTests/accessibility/ios-simulator/dom-focus-fires-on-correct-element-expected.txt	2018-06-27 15:14:45 UTC (rev 233256)
+++ trunk/LayoutTests/accessibility/ios-simulator/dom-focus-fires-on-correct-element-expected.txt	2018-06-27 16:10:21 UTC (rev 233257)
@@ -1,16 +0,0 @@
-link1
-heading1
-
-This tests that accessibilityElementDidBecomeFocused will be propagated to the correct parent and cause DOM focus to fire on the correct elements.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS textInsideLink.description is 'AXLabel: link1'
-PASS accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideLink) is true
-PASS textInsideHeading.description is 'AXLabel: heading1'
-PASS accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideHeading) is true
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/accessibility/ios-simulator/dom-focus-fires-on-correct-element.html (233256 => 233257)


--- trunk/LayoutTests/accessibility/ios-simulator/dom-focus-fires-on-correct-element.html	2018-06-27 15:14:45 UTC (rev 233256)
+++ trunk/LayoutTests/accessibility/ios-simulator/dom-focus-fires-on-correct-element.html	2018-06-27 16:10:21 UTC (rev 233257)
@@ -1,52 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src=""
-</head>
-<body id="body">
-
-
-<a id="link1" href=""
-
-<h1 id="heading1" tabindex=0>heading1</h1>
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-
-    description("This tests that accessibilityElementDidBecomeFocused will be propagated to the correct parent and cause DOM focus to fire on the correct elements.");
-
-
-    if (window.accessibilityController) {
-
-        var body = accessibilityController.rootElement;
-
-        // Get access to the text inside the link.
-        var textInsideLink = accessibilityController.accessibleElementById("link1").childAtIndex(0);
-        shouldBe("textInsideLink.description", "'AXLabel: link1'");
-
-        // Simulate VoiceOver focus onto the element.
-        textInsideLink.assistiveTechnologySimulatedFocus();
-
-        // The new focused element should now be the link itself.
-        shouldBeTrue("accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideLink)");
-
-        // Repeat for text inside link inside heading.
-
-        // Get access to the text inside the link.
-        var textInsideHeading = accessibilityController.accessibleElementById("heading1").childAtIndex(0);
-        shouldBe("textInsideHeading.description", "'AXLabel: heading1'");
-
-        // Simulate VoiceOver focus onto the element.
-        textInsideHeading.assistiveTechnologySimulatedFocus();
-
-        // The new focused element should now be the link itself.
-        shouldBeTrue("accessibilityController.focusedElement.childAtIndex(0).isEqual(textInsideHeading)");
-    }
-
-</script>
-
-<script src=""
-</body>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (233256 => 233257)


--- trunk/Source/WebCore/ChangeLog	2018-06-27 15:14:45 UTC (rev 233256)
+++ trunk/Source/WebCore/ChangeLog	2018-06-27 16:10:21 UTC (rev 233257)
@@ -1,3 +1,18 @@
+2018-06-27  Nan Wang  <n_w...@apple.com>
+
+        AX: [iOS] Remove the ability to set keyboard focus when VoiceOver takes focus
+        https://bugs.webkit.org/show_bug.cgi?id=187076
+
+        Reviewed by Chris Fleizach.
+
+        We shouldn't set keyboard focus when assistive technology takes focus since
+        this is causing website incompatibility issues by causing focus to be lost.
+
+        Test: accessibility/ios-simulator/accessibility-focus-do-not-set-focus.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):
+
 2018-06-21  Emilio Cobos Álvarez  <emi...@crisal.io>
 
         Move clearChildNeedsStyleRecalc into resetStyleForNonRenderedDescendants.

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (233256 => 233257)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2018-06-27 15:14:45 UTC (rev 233256)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2018-06-27 16:10:21 UTC (rev 233257)
@@ -2063,26 +2063,7 @@
     if (![self _prepareAccessibilityCall])
         return;
     
-    // The focused VoiceOver element might be the text inside a link.
-    // In those cases we should focus on the link itself.
-    for (AccessibilityObject* object = m_object; object != nil; object = object->parentObject()) {
-        if (object->roleValue() == AccessibilityRole::WebArea)
-            break;
-
-        if (object->canSetFocusAttribute()) {
-            // webkit.org/b/162041 Taking focus onto elements inside a details node will cause VO focusing onto random items.
-            if ([self detailParentForObject:object])
-                break;
-            
-            // webkit.org/b/162322 When a dialog is focusable, allowing focusing onto the dialog node will cause VO cursor jumping
-            // back and forward while navigating its children.
-            if ([object->wrapper() accessibilityIsDialog])
-                break;
-            
-            object->setFocused(true);
-            break;
-        }
-    }
+    m_object->dispatchAccessibilityEventWithType(AccessibilityEventType::Focus);
 }
 
 - (void)accessibilityModifySelection:(TextGranularity)granularity increase:(BOOL)increase
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to