-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AX: VoiceOver reads erroneous value for datetime-local input elements.
https://bugs.webkit.org/show_bug.cgi?id=270276 <rdar://problem/123803281> Reviewed by Tyler Wilcock. AccessibilityNodeObject::dateTimeValue() relied on HTMLInputElement::valueAsDate(), that in turn forwards to an override of InputType::valueAsDate. The problem is that DateTimeLocalInputType::valueAsDate returns NaN unlike the overrides in the other subclasses of BaseDateAndTimeInputType. To solve this problem, we added the method accessibilityValueAsDate() that returns the right value for all BaseDateAndTimeInputType subclasses including DateTimeLocalInputType. Added the AccessibilityUIElement::dateValue() method to the TestRunner to exercise this functionality. The new test does just that for datetime-local input elements. * LayoutTests/accessibility/datetime/input-datetime-local-label-value-expected.txt: Added. * LayoutTests/accessibility/datetime/input-datetime-local-label-value.html: Added. * LayoutTests/platform/glib/TestExpectations: * LayoutTests/platform/mac-monterey/accessibility/datetime/input-datetime-local-label-value-expected.txt: Added. * LayoutTests/platform/mac-wk1/TestExpectations: * Source/WebCore/accessibility/AccessibilityNodeObject.cpp: (WebCore::AccessibilityNodeObject::dateTimeValue const): * Source/WebCore/html/BaseDateAndTimeInputType.cpp: (WebCore::BaseDateAndTimeInputType::accessibilityValueAsDate const): * Source/WebCore/html/BaseDateAndTimeInputType.h: * Source/WebCore/html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::accessibilityValueAsDate const): * Source/WebCore/html/HTMLInputElement.h: * Source/WebCore/html/InputType.cpp: (WebCore::InputType::accessibilityValueAsDate const): * Source/WebCore/html/InputType.h: * Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: * Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::stringValue): (WTR::AccessibilityUIElement::dateValue): Canonical link: https://commits.webkit.org/275548@main
- Loading branch information
1 parent
4c3c883
commit 1377080
Showing
16 changed files
with
145 additions
and
10 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
LayoutTests/accessibility/datetime/input-datetime-local-label-value-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
This tests input type=datetime-local label and value properties. | ||
|
||
datetime1: | ||
PASS: datetime.title === 'AXTitle: Meeting time:' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
datetime2: | ||
PASS: datetime.title === 'AXTitle: Meeting time:' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
datetime3: | ||
PASS: datetime.title === 'AXTitle: Meeting time:' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
datetime4: | ||
PASS: datetime.title === 'AXTitle: ' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Meeting time: Meeting time: |
48 changes: 48 additions & 0 deletions
48
LayoutTests/accessibility/datetime/input-datetime-local-label-value.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../../resources/accessibility-helper.js"></script> | ||
<script src="../../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
|
||
<input type="datetime-local" value="2024-10-21T15:45:59" aria-label="Meeting time:" id="datetime1" /> | ||
|
||
<label for="datetime2">Meeting time:</label> | ||
<input type="datetime-local" value="2024-10-21T15:45:59" id="datetime2" /> | ||
|
||
<label> | ||
Meeting time: | ||
<input type="datetime-local" value="2024-10-21T15:45:59" id="datetime3" /> | ||
</label> | ||
|
||
<input type="datetime-local" value="2024-10-21T15:45:59" id="datetime4" /> | ||
|
||
<script> | ||
let output = "This tests input type=datetime-local label and value properties.\n\n"; | ||
|
||
if (window.accessibilityController) { | ||
var datetime = null; | ||
function outputDateTimeElement(id) { | ||
datetime = accessibilityController.accessibleElementById(id); | ||
output += `${datetime.domIdentifier}:\n`; | ||
output += expect("datetime.title", "'AXTitle: Meeting time:'"); | ||
output += `${datetime.stringValue}\n`; | ||
output += `${datetime.dateValue}\n\n`; | ||
} | ||
|
||
for (let i = 1; i <= 3; ++i) | ||
outputDateTimeElement(`datetime${i}`); | ||
|
||
// Case 4: no label. | ||
datetime = accessibilityController.accessibleElementById("datetime4"); | ||
output += "datetime4:\n"; | ||
output += expect("datetime.title", "'AXTitle: '"); | ||
output += `${datetime.stringValue}\n`; | ||
output += `${datetime.dateValue}\n\n`; | ||
|
||
debug(output); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...latform/mac-monterey/accessibility/datetime/input-datetime-local-label-value-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
This tests input type=datetime-local label and value properties. | ||
|
||
datetime1: | ||
PASS: datetime.title === 'AXTitle: Meeting time:' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
datetime2: | ||
PASS: datetime.title === 'AXTitle: Meeting time:' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
datetime3: | ||
PASS: datetime.title === 'AXTitle: Meeting time:' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
datetime4: | ||
PASS: datetime.title === 'AXTitle: ' | ||
AXValue: Oct 21, 2024 at 3:45 PM | ||
AXDateValue: 2024-10-21 15:45:59 +0000 | ||
|
||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Meeting time: Meeting time: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters