⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179820 in webkit


Ignore:
Timestamp:
Feb 8, 2015, 11:09:50 PM (12 years ago)
Author:
Chris Fleizach
Message:

AX: VoiceOver appears unresponsive when JavaScript alerts are triggered via focus or blur events
https://bugs.webkit.org/show_bug.cgi?id=140485

Reviewed by Anders Carlsson.

Source/WebCore:

If setting an accessibility attribute results in a modal alert being displayed, it can cause VoiceOver
to hang. A simple solution is perform the actual work after a short delay, which will ensure the call
returns without hanging.

Test: platform/mac/accessibility/setting-attributes-is-asynchronous.html

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
(-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):

Tools:

Implement takeFocus() as a way to set focus through accessibility wrappers.

  • DumpRenderTree/mac/AccessibilityUIElementMac.mm:

(AccessibilityUIElement::takeFocus):

  • WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:

(WTR::AccessibilityUIElement::takeFocus):

LayoutTests:

Modify tests that relied on setting behavior and immediately checking results. Those
tests now need to retrieve results after a short timeout.

  • accessibility/textarea-selected-text-range-expected.txt:
  • accessibility/textarea-selected-text-range.html:
  • platform/mac/accessibility/select-element-selection-with-optgroups.html:
  • platform/mac/accessibility/setting-attributes-is-asynchronous-expected.txt: Added.
  • platform/mac/accessibility/setting-attributes-is-asynchronous.html: Added.
Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r179819 r179820  
     12015-02-08  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: VoiceOver appears unresponsive when JavaScript alerts are triggered via focus or blur events
     4        https://bugs.webkit.org/show_bug.cgi?id=140485
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Modify tests that relied on setting behavior and immediately checking results. Those
     9        tests now need to retrieve results after a short timeout.
     10
     11        * accessibility/textarea-selected-text-range-expected.txt:
     12        * accessibility/textarea-selected-text-range.html:
     13        * platform/mac/accessibility/select-element-selection-with-optgroups.html:
     14        * platform/mac/accessibility/setting-attributes-is-asynchronous-expected.txt: Added.
     15        * platform/mac/accessibility/setting-attributes-is-asynchronous.html: Added.
     16
    1172015-02-08  Benjamin Poulain  <benjamin@webkit.org>
    218
  • trunk/LayoutTests/accessibility/textarea-selected-text-range-expected.txt

    r36772 r179820  
    1 (4,0) = {4, 0}
     1PASS textArea.selectedTextRange is '{4, 0}'
     2PASS textArea.selectedTextRange is '{8, 2}'
     3PASS textArea.selectedTextRange is '{25, 0}'
     4PASS successfullyParsed is true
    25
    3 (8,2) = {8, 2}
     6TEST COMPLETE
    47
    5 (100,0) = {25, 0}
    6 
    7 
  • trunk/LayoutTests/accessibility/textarea-selected-text-range.html

    r120111 r179820  
    11<html>
    2 <script>
    3     if (window.testRunner)
    4         testRunner.dumpAsText();
    5 </script>
     2<script src="../resources/js-test-pre.js"></script>
    63<body>
    74   
     
    1613    <script>
    1714        if (window.accessibilityController) {
    18             var result = document.getElementById("result");
    19 
     15            window.jsTestIsAsync = true;
    2016            var area1 = document.getElementById("area1");
    2117            area1.focus();
     
    2420
    2521            textArea.setSelectedTextRange(4,0);
    26             result.innerText += "(4,0) = " + textArea.selectedTextRange + "\n\n";
    2722
    28             textArea.setSelectedTextRange(8,2);
    29             result.innerText += "(8,2) = " + textArea.selectedTextRange + "\n\n";
    30 
    31             textArea.setSelectedTextRange(100,0);
    32             result.innerText += "(100,0) = " + textArea.selectedTextRange + "\n\n";
     23            // After setting a property through accessibility, the value won't be updated immediately, so we
     24            // must check after a timeout to re-verify the value.
     25            setTimeout(function() {
     26                shouldBe("textArea.selectedTextRange", "'{4, 0}'");
     27                textArea.setSelectedTextRange(8,2);
     28                setTimeout(function() {
     29                    shouldBe("textArea.selectedTextRange", "'{8, 2}'");
     30                    textArea.setSelectedTextRange(100,0);
     31                    setTimeout(function() {
     32                        shouldBe("textArea.selectedTextRange", "'{25, 0}'");
     33                        finishJSTest();
     34                    }, 1);
     35                }, 1);
     36            }, 1);
    3337
    3438        }
    3539    </script>
     40<script src="../resources/js-test-post.js"></script>
    3641</body>
    3742</html>
  • trunk/LayoutTests/platform/mac/accessibility/select-element-selection-with-optgroups.html

    r155282 r179820  
    2727
    2828    if (window.accessibilityController) {
     29          window.jsTestIsAsync = true;
    2930
    3031          document.getElementById("suite").focus();
     
    3738          var option3 = selectElement.childAtIndex(4);
    3839
     40          // Selection operations happen after a delay so they don't hang. Check the result on a timeout.
    3941          selectElement.setSelectedChild(option1);
    40           shouldBe("selectElement.selectedChildrenCount", "1");
    41           shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option1)");
     42          setTimeout(function() {
     43              shouldBe("selectElement.selectedChildrenCount", "1");
     44              shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option1)");
    4245
    43           selectElement.setSelectedChild(option2);
    44           shouldBe("selectElement.selectedChildrenCount", "1");
    45           shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option2)");
     46              selectElement.setSelectedChild(option2);
     47              setTimeout(function() {
     48                  shouldBe("selectElement.selectedChildrenCount", "1");
     49                  shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option2)");
    4650
    47           selectElement.setSelectedChild(option3);
    48           shouldBe("selectElement.selectedChildrenCount", "1");
    49           shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option3)");
     51                  selectElement.setSelectedChild(option3);
     52                  setTimeout(function() {
     53                      shouldBe("selectElement.selectedChildrenCount", "1");
     54                      shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option3)");
     55                      finishJSTest();
     56                  }, 1);
     57              }, 1);
     58           }, 1);
     59       
    5060    }
    5161
  • trunk/Source/WebCore/ChangeLog

    r179819 r179820  
     12015-02-08  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: VoiceOver appears unresponsive when JavaScript alerts are triggered via focus or blur events
     4        https://bugs.webkit.org/show_bug.cgi?id=140485
     5
     6        Reviewed by Anders Carlsson.
     7
     8        If setting an accessibility attribute results in a modal alert being displayed, it can cause VoiceOver
     9        to hang. A simple solution is perform the actual work after a short delay, which will ensure the call
     10        returns without hanging.
     11
     12        Test: platform/mac/accessibility/setting-attributes-is-asynchronous.html
     13
     14        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     15        (-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
     16        (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
     17
    1182015-02-08  Benjamin Poulain  <benjamin@webkit.org>
    219
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r179450 r179820  
    32473247- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName
    32483248{
     3249    // In case anything we do by changing values causes an alert or other modal
     3250    // behaviors, we need to return now, so that VoiceOver doesn't hang indefinitely.
     3251    dispatch_async(dispatch_get_main_queue(), ^{
     3252        [self _accessibilitySetValue:value forAttribute:attributeName];
     3253    });
     3254}
     3255
     3256- (void)_accessibilitySetValue:(id)value forAttribute:(NSString*)attributeName
     3257{
    32493258    if (![self updateObjectBackingStore])
    32503259        return;
  • trunk/Tools/ChangeLog

    r179810 r179820  
     12015-02-08  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: VoiceOver appears unresponsive when JavaScript alerts are triggered via focus or blur events
     4        https://bugs.webkit.org/show_bug.cgi?id=140485
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Implement takeFocus() as a way to set focus through accessibility wrappers.
     9
     10        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
     11        (AccessibilityUIElement::takeFocus):
     12        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
     13        (WTR::AccessibilityUIElement::takeFocus):
     14
    1152015-02-08  Darin Adler  <darin@apple.com>
    216
  • trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r179450 r179820  
    15181518void AccessibilityUIElement::takeFocus()
    15191519{
    1520     // FIXME: implement
     1520    BEGIN_AX_OBJC_EXCEPTIONS
     1521    [m_element accessibilitySetValue:@YES forAttribute:NSAccessibilityFocusedAttribute];
     1522    END_AX_OBJC_EXCEPTIONS
    15211523}
    15221524
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl

    r169483 r179820  
    169169
    170170    void scrollToMakeVisible();
     171    void takeFocus();
    171172
    172173    // Text markers.
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r179450 r179820  
    15331533void AccessibilityUIElement::takeFocus()
    15341534{
    1535     // FIXME: implement
     1535    BEGIN_AX_OBJC_EXCEPTIONS
     1536    [m_element accessibilitySetValue:@YES forAttribute:NSAccessibilityFocusedAttribute];
     1537    END_AX_OBJC_EXCEPTIONS
    15361538}
    15371539
Note: See TracChangeset for help on using the changeset viewer.