Changeset 140803 in webkit


Ignore:
Timestamp:
Jan 25, 2013 2:10:47 AM (11 years ago)
Author:
tkent@chromium.org
Message:

INPUT_MULTIPLE_FIELDS_UI: Inconsistent value of aria-valuetext attribute
https://bugs.webkit.org/show_bug.cgi?id=107897

Reviewed by Kentaro Hara.

Source/WebCore:

aria-valuetext and aria-valuenow attributes had inconsistent values in
a case of initial empty state and a case that a user clears a field.

  • aria-valuetext attribute should have "blank" message in the initial empty state.
  • aria-valuenow attribute should be removed in the cleared empty state.

Also, we have a bug that aira-valuenow had a symbolic value such as "AM"
"January". It should always have a numeric value according to the
specification.
http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow

No new tests. Updates fast/forms/*-multiple-fields/*-multiple-fields-ax-aria-attributes.html.

  • html/shadow/DateTimeFieldElement.cpp:

(WebCore::DateTimeFieldElement::DateTimeFieldElement):
Set "blank" message to aria-valuetext attribute.
(WebCore::DateTimeFieldElement::updateVisibleValue):
aria-valuenow attribute should be a numeric value. Apply String::number
to the return value of valueForARIAValueNow.
Remove aria-valuenow attribute if nothing is selected.
(WebCore::DateTimeFieldElement::valueForARIAValueNow):
Added.

  • html/shadow/DateTimeFieldElement.h:

(DateTimeFieldElement): Declare valueForARIAValueNow.

  • html/shadow/DateTimeSymbolicFieldElement.cpp:

(WebCore::DateTimeSymbolicFieldElement::valueForARIAValueNow):
Added. Returns 1 + internal selection index.
For example, the function returns 1 for January.

  • html/shadow/DateTimeSymbolicFieldElement.h:

(DateTimeSymbolicFieldElement): Declare valueForARIAValueNow.

LayoutTests:

Fix existing tests to show aria-valuenow attribute values.

  • fast/forms/resources/multiple-fields-ax-aria-attributes.js: Added.
  • fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes-expected.txt:
  • fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes.html:

Use multiple-fields-ax-aria-attributes.js.
Add tests for initial empty-value state.

  • fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes-expected.txt:
  • fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes.html:

Use multiple-fields-ax-aria-attributes.js.

  • fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes-expected.txt:
  • fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes.html:

Use multiple-fields-ax-aria-attributes.js.

Location:
trunk
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140799 r140803  
     12013-01-25  Kent Tamura  <tkent@chromium.org>
     2
     3        INPUT_MULTIPLE_FIELDS_UI: Inconsistent value of aria-valuetext attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=107897
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Fix existing tests to show aria-valuenow attribute values.
     9
     10        * fast/forms/resources/multiple-fields-ax-aria-attributes.js: Added.
     11        * fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes-expected.txt:
     12        * fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes.html:
     13        Use multiple-fields-ax-aria-attributes.js.
     14        Add tests for initial empty-value state.
     15        * fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes-expected.txt:
     16        * fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes.html:
     17        Use multiple-fields-ax-aria-attributes.js.
     18        * fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes-expected.txt:
     19        * fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes.html:
     20        Use multiple-fields-ax-aria-attributes.js.
     21
    1222013-01-25  Keishi Hattori  <keishi@webkit.org>
    223
  • trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes-expected.txt

    r130884 r140803  
    44
    55
     6Initial empty state
     7PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12"
     8PASS focusedElementDescription() is "AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31"
     9PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760"
    610Non-empty value
    7 PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: 10, 1, 12"
    8 PASS focusedFieldValueDescription() is "AXHelp: Day, AXValueDescription: 09, 1, 31"
    9 PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: 2012, 1, 275760"
     11PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: 10, intValue:10, range:1-12"
     12PASS focusedElementDescription() is "AXHelp: Day, AXValueDescription: 09, intValue:9, range:1-31"
     13PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760"
    1014Empty value
    11 PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: blank, 1, 275760"
    12 PASS focusedFieldValueDescription() is "AXHelp: Day, AXValueDescription: blank, 1, 31"
    13 PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: blank, 1, 12"
     15PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760"
     16PASS focusedElementDescription() is "AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31"
     17PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12"
    1418
    1519PASS successfullyParsed is true
  • trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-ax-aria-attributes.html

    r130884 r140803  
    33<head>
    44<script src="../../../fast/js/resources/js-test-pre.js"></script>
     5<script src="../resources/multiple-fields-ax-aria-attributes.js"></script>
    56</head>
    67<body>
    7 <input id="test" type="date" value="2012-10-09">
     8<input id="test" type="date">
    89<script>
    910description('This test checks aria-help attribute of fields in multiple fields date input UI.');
    10 
    11 function focusedFieldValueDescription()
    12 {
    13     var element = accessibilityController.focusedElement;
    14     return element.helpText + ', ' +  element.valueDescription + ', ' + element.minValue + ', ' + element.maxValue;
    15 }
    1611
    1712var testInput = document.getElementById('test');
     
    2015    debug('Please run inside DRT or WTR.');
    2116else {
     17    testInput.focus();
     18    debug('Initial empty state');
     19    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12');
     20    eventSender.keyDown('\t');
     21    checkFocusedElementAXAttributes('AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31');
     22    eventSender.keyDown('\t');
     23    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760');
     24
     25    eventSender.keyDown('\t', ['shiftKey']);
     26    eventSender.keyDown('\t', ['shiftKey']);
    2227    debug('Non-empty value');
    23     testInput.focus();
    24     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: 10, 1, 12');
     28    testInput.value = "2012-10-09";
     29    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: 10, intValue:10, range:1-12');
    2530    eventSender.keyDown('\t');
    26     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Day, AXValueDescription: 09, 1, 31');
     31    checkFocusedElementAXAttributes('AXHelp: Day, AXValueDescription: 09, intValue:9, range:1-31');
    2732    eventSender.keyDown('\t');
    28     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: 2012, 1, 275760');
     33    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760');
    2934
    3035    debug('Empty value');
    3136    eventSender.keyDown('\b');
    32     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: blank, 1, 275760');
     37    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760');
    3338    eventSender.keyDown('\t', ['shiftKey']);
    3439    eventSender.keyDown('\b');
    35     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Day, AXValueDescription: blank, 1, 31');
     40    checkFocusedElementAXAttributes('AXHelp: Day, AXValueDescription: blank, intValue:0, range:1-31');
    3641    eventSender.keyDown('\t', ['shiftKey']);
    3742    eventSender.keyDown('\b');
    38     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: blank, 1, 12');
     43    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12');
    3944
    4045    debug('');
  • trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes-expected.txt

    r136202 r140803  
    55
    66Non-empty value
    7 PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: October, 1, 12"
    8 PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: 2012, 1, 275760"
     7PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: October, intValue:10, range:1-12"
     8PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760"
    99Empty value
    10 PASS focusedFieldValueDescription() is "AXHelp: Year, AXValueDescription: blank, 1, 275760"
    11 PASS focusedFieldValueDescription() is "AXHelp: Month, AXValueDescription: blank, 1, 12"
     10PASS focusedElementDescription() is "AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760"
     11PASS focusedElementDescription() is "AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12"
    1212
    1313PASS successfullyParsed is true
  • trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-ax-aria-attributes.html

    r136202 r140803  
    33<head>
    44<script src="../../../fast/js/resources/js-test-pre.js"></script>
     5<script src="../resources/multiple-fields-ax-aria-attributes.js"></script>
    56</head>
    67<body>
     
    89<script>
    910description('This test checks aria-help attribute of fields in multiple fields week input UI.');
    10 
    11 function focusedFieldValueDescription()
    12 {
    13     var element = accessibilityController.focusedElement;
    14     return element.helpText + ', ' +  element.valueDescription + ', ' + element.minValue + ', ' + element.maxValue;
    15 }
    1611
    1712var testInput = document.getElementById('test');
     
    2217    debug('Non-empty value');
    2318    testInput.focus();
    24     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: October, 1, 12');
     19    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: October, intValue:10, range:1-12');
    2520    eventSender.keyDown('\t');
    26     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: 2012, 1, 275760');
     21    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: 2012, intValue:2012, range:1-275760');
    2722
    2823    debug('Empty value');
    2924    eventSender.keyDown('\b');
    30     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Year, AXValueDescription: blank, 1, 275760');
     25    checkFocusedElementAXAttributes('AXHelp: Year, AXValueDescription: blank, intValue:0, range:1-275760');
    3126    eventSender.keyDown('\t', ['shiftKey']);
    3227    eventSender.keyDown('\b');
    33     shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Month, AXValueDescription: blank, 1, 12');
     28    checkFocusedElementAXAttributes('AXHelp: Month, AXValueDescription: blank, intValue:0, range:1-12');
    3429
    3530    debug('');
  • trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes-expected.txt

    r128404 r140803  
    55
    66Non-empty value
    7 PASS focusedFieldValueDescription() is "AXHelp: Hours, AXValueDescription: 12, 1, 12"
    8 PASS focusedFieldValueDescription() is "AXHelp: Minutes, AXValueDescription: 34, 0, 59"
    9 PASS focusedFieldValueDescription() is "AXHelp: Seconds, AXValueDescription: 56, 0, 59"
    10 PASS focusedFieldValueDescription() is "AXHelp: Milliseconds, AXValueDescription: 789, 0, 999"
    11 PASS focusedFieldValueDescription() is "AXHelp: AM/PM, AXValueDescription: PM, 1, 2"
     7PASS focusedElementDescription() is "AXHelp: Hours, AXValueDescription: 12, intValue:12, range:1-12"
     8PASS focusedElementDescription() is "AXHelp: Minutes, AXValueDescription: 34, intValue:34, range:0-59"
     9PASS focusedElementDescription() is "AXHelp: Seconds, AXValueDescription: 56, intValue:56, range:0-59"
     10PASS focusedElementDescription() is "AXHelp: Milliseconds, AXValueDescription: 789, intValue:789, range:0-999"
     11PASS focusedElementDescription() is "AXHelp: AM/PM, AXValueDescription: PM, intValue:2, range:1-2"
    1212Empty value
    13 PASS focusedFieldValueDescription() is "AXHelp: AM/PM, AXValueDescription: blank, 1, 2"
    14 PASS focusedFieldValueDescription() is "AXHelp: Milliseconds, AXValueDescription: blank, 0, 999"
    15 PASS focusedFieldValueDescription() is "AXHelp: Seconds, AXValueDescription: blank, 0, 59"
    16 PASS focusedFieldValueDescription() is "AXHelp: Minutes, AXValueDescription: blank, 0, 59"
    17 PASS focusedFieldValueDescription() is "AXHelp: Hours, AXValueDescription: blank, 1, 12"
     13PASS focusedElementDescription() is "AXHelp: AM/PM, AXValueDescription: blank, intValue:0, range:1-2"
     14PASS focusedElementDescription() is "AXHelp: Milliseconds, AXValueDescription: blank, intValue:0, range:0-999"
     15PASS focusedElementDescription() is "AXHelp: Seconds, AXValueDescription: blank, intValue:0, range:0-59"
     16PASS focusedElementDescription() is "AXHelp: Minutes, AXValueDescription: blank, intValue:0, range:0-59"
     17PASS focusedElementDescription() is "AXHelp: Hours, AXValueDescription: blank, intValue:0, range:1-12"
    1818
    1919PASS successfullyParsed is true
  • trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-ax-aria-attributes.html

    r128404 r140803  
    33<head>
    44<script src="../../../fast/js/resources/js-test-pre.js"></script>
     5<script src="../resources/multiple-fields-ax-aria-attributes.js"></script>
    56</head>
    67<body>
     
    1516        return;
    1617    }
    17 }
    18 
    19 function focusedFieldValueDescription()
    20 {
    21     if (!window.accessibilityController)
    22         return;
    23     var element = accessibilityController.focusedElement
    24     return element.helpText + ", " +  element.valueDescription + ", " + element.minValue + ", " + element.maxValue;
    2518}
    2619
     
    3932debug('Non-empty value');
    4033testInput.focus();
    41 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Hours, AXValueDescription: 12, 1, 12');
     34checkFocusedElementAXAttributes('AXHelp: Hours, AXValueDescription: 12, intValue:12, range:1-12');
    4235keyDown('\t');
    43 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Minutes, AXValueDescription: 34, 0, 59');
     36checkFocusedElementAXAttributes('AXHelp: Minutes, AXValueDescription: 34, intValue:34, range:0-59');
    4437keyDown('\t');
    45 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Seconds, AXValueDescription: 56, 0, 59');
     38checkFocusedElementAXAttributes('AXHelp: Seconds, AXValueDescription: 56, intValue:56, range:0-59');
    4639keyDown('\t');
    47 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Milliseconds, AXValueDescription: 789, 0, 999');
     40checkFocusedElementAXAttributes('AXHelp: Milliseconds, AXValueDescription: 789, intValue:789, range:0-999');
    4841keyDown('\t');
    49 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: AM/PM, AXValueDescription: PM, 1, 2');
     42checkFocusedElementAXAttributes('AXHelp: AM/PM, AXValueDescription: PM, intValue:2, range:1-2');
    5043
    5144debug('Empty value');
    5245keyDown('\b');
    53 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: AM/PM, AXValueDescription: blank, 1, 2');
     46checkFocusedElementAXAttributes('AXHelp: AM/PM, AXValueDescription: blank, intValue:0, range:1-2');
    5447keyDown('\t', ['shiftKey']);
    5548keyDown('\b');
    56 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Milliseconds, AXValueDescription: blank, 0, 999');
     49checkFocusedElementAXAttributes('AXHelp: Milliseconds, AXValueDescription: blank, intValue:0, range:0-999');
    5750keyDown('\t', ['shiftKey']);
    5851keyDown('\b');
    59 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Seconds, AXValueDescription: blank, 0, 59');
     52checkFocusedElementAXAttributes('AXHelp: Seconds, AXValueDescription: blank, intValue:0, range:0-59');
    6053keyDown('\t', ['shiftKey']);
    6154keyDown('\b');
    62 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Minutes, AXValueDescription: blank, 0, 59');
     55checkFocusedElementAXAttributes('AXHelp: Minutes, AXValueDescription: blank, intValue:0, range:0-59');
    6356keyDown('\t', ['shiftKey']);
    6457keyDown('\b');
    65 shouldBeEqualToString('focusedFieldValueDescription()', 'AXHelp: Hours, AXValueDescription: blank, 1, 12');
     58checkFocusedElementAXAttributes('AXHelp: Hours, AXValueDescription: blank, intValue:0, range:1-12');
    6659
    6760debug('');
  • trunk/Source/WebCore/ChangeLog

    r140800 r140803  
     12013-01-25  Kent Tamura  <tkent@chromium.org>
     2
     3        INPUT_MULTIPLE_FIELDS_UI: Inconsistent value of aria-valuetext attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=107897
     5
     6        Reviewed by Kentaro Hara.
     7
     8        aria-valuetext and aria-valuenow attributes had inconsistent values in
     9        a case of initial empty state and a case that a user clears a field.
     10
     11        - aria-valuetext attribute should have "blank" message in the initial
     12          empty state.
     13        - aria-valuenow attribute should be removed in the cleared empty state.
     14
     15        Also, we have a bug that aira-valuenow had a symbolic value such as "AM"
     16        "January". It should always have a numeric value according to the
     17        specification.
     18        http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow
     19
     20        No new tests. Updates fast/forms/*-multiple-fields/*-multiple-fields-ax-aria-attributes.html.
     21
     22        * html/shadow/DateTimeFieldElement.cpp:
     23        (WebCore::DateTimeFieldElement::DateTimeFieldElement):
     24        Set "blank" message to aria-valuetext attribute.
     25        (WebCore::DateTimeFieldElement::updateVisibleValue):
     26        aria-valuenow attribute should be a numeric value. Apply String::number
     27        to the return value of valueForARIAValueNow.
     28        Remove aria-valuenow attribute if nothing is selected.
     29        (WebCore::DateTimeFieldElement::valueForARIAValueNow):
     30        Added.
     31        * html/shadow/DateTimeFieldElement.h:
     32        (DateTimeFieldElement): Declare valueForARIAValueNow.
     33
     34        * html/shadow/DateTimeSymbolicFieldElement.cpp:
     35        (WebCore::DateTimeSymbolicFieldElement::valueForARIAValueNow):
     36        Added. Returns 1 + internal selection index.
     37        For example, the function returns 1 for January.
     38        * html/shadow/DateTimeSymbolicFieldElement.h:
     39        (DateTimeSymbolicFieldElement): Declare valueForARIAValueNow.
     40
    1412013-01-24  Hans Wennborg  <hans@chromium.org>
    242
  • trunk/Source/WebCore/html/shadow/DateTimeFieldElement.cpp

    r140791 r140803  
    5151    // On accessibility, DateTimeFieldElement acts like spin button.
    5252    setAttribute(roleAttr, "spinbutton");
     53    setAttribute(aria_valuetextAttr, AXDateTimeFieldEmptyValueText());
    5354}
    5455
     
    207208
    208209    textNode->replaceWholeText(newVisibleValue, ASSERT_NO_EXCEPTION);
    209     setAttribute(aria_valuetextAttr, hasValue() ? newVisibleValue : AXDateTimeFieldEmptyValueText());
    210     setAttribute(aria_valuenowAttr, newVisibleValue);
     210    if (hasValue()) {
     211        setAttribute(aria_valuetextAttr, newVisibleValue);
     212        setAttribute(aria_valuenowAttr, String::number(valueForARIAValueNow()));
     213    } else {
     214        setAttribute(aria_valuetextAttr, AXDateTimeFieldEmptyValueText());
     215        removeAttribute(aria_valuenowAttr);
     216    }
    211217
    212218    if (eventBehavior == DispatchEvent && m_fieldOwner)
     
    214220}
    215221
     222int DateTimeFieldElement::valueForARIAValueNow() const
     223{
     224    return valueAsInteger();
     225}
     226
    216227} // namespace WebCore
    217228
  • trunk/Source/WebCore/html/shadow/DateTimeFieldElement.h

    r140791 r140803  
    8888    void updateVisibleValue(EventBehavior);
    8989    virtual int valueAsInteger() const = 0;
     90    virtual int valueForARIAValueNow() const;
    9091
    9192private:
  • trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp

    r140791 r140803  
    145145}
    146146
     147int DateTimeSymbolicFieldElement::valueForARIAValueNow() const
     148{
     149    // Synchronize with minimum/maximum adjustment in initialize().
     150    return m_selectedIndex + 1;
     151}
     152
    147153String DateTimeSymbolicFieldElement::visibleEmptyValue() const
    148154{
  • trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h

    r140791 r140803  
    5959    virtual void stepUp() OVERRIDE FINAL;
    6060    virtual String value() const OVERRIDE FINAL;
     61    virtual int valueForARIAValueNow() const OVERRIDE FINAL;
    6162    virtual String visibleValue() const OVERRIDE FINAL;
    6263
Note: See TracChangeset for help on using the changeset viewer.