haikuwebkit/LayoutTests/accessibility/focusable-div.html

93 lines
3.4 KiB
HTML
Raw Permalink Normal View History

AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
<!DOCTYPE HTML>
<html>
<body>
Change LayoutTests' a* and b* files to use pre and post js files in LayoutTests/resources. https://bugs.webkit.org/show_bug.cgi?id=120985. Rubber stamped by Filip Pizlo. * accessibility/accessibility-node-memory-management.html: * accessibility/accessibility-node-reparent.html: * accessibility/accessibility-object-detached.html: * accessibility/adjacent-continuations-cause-assertion-failure.html: * accessibility/anonymous-render-block-in-continuation-causes-crash.html: * accessibility/aria-checkbox-checked.html: * accessibility/aria-checkbox-sends-notification.html: * accessibility/aria-checkbox-text.html: * accessibility/aria-combobox.html: * accessibility/aria-controls-with-tabs.html: * accessibility/aria-disabled.html: * accessibility/aria-fallback-roles.html: * accessibility/aria-help.html: * accessibility/aria-hidden-hides-all-elements.html: * accessibility/aria-hidden-update.html: * accessibility/aria-hidden-updates-alldescendants.html: * accessibility/aria-hidden-with-elements.html: * accessibility/aria-hidden.html: * accessibility/aria-invalid.html: * accessibility/aria-label.html: * accessibility/aria-labelledby-overrides-label.html: * accessibility/aria-list-and-listitem.html: * accessibility/aria-menubar-menuitems.html: * accessibility/aria-option-role.html: * accessibility/aria-presentational-role.html: * accessibility/aria-readonly.html: * accessibility/aria-required.html: * accessibility/aria-scrollbar-role.html: * accessibility/aria-sort.html: * accessibility/aria-tab-role-on-buttons.html: * accessibility/aria-tab-roles.html: * accessibility/aria-text-role.html: * accessibility/aria-toggle-button-with-title.html: * accessibility/aria-used-on-image-maps.html: * accessibility/button-title-uses-inner-img-alt.html: * accessibility/canvas-accessibilitynodeobject.html: * accessibility/canvas-description-and-role.html: * accessibility/canvas-fallback-content-2.html: * accessibility/canvas-fallback-content.html: * accessibility/color-well.html: * accessibility/container-node-delete-causes-crash.html: * accessibility/content-changed-notification-causes-crash.html: * accessibility/contenteditable-hidden-div.html: * accessibility/contenteditable-table-check-causes-crash.html: * accessibility/corresponding-control-deleted-crash.html: * accessibility/crash-adopt-node-from-new-document.html: * accessibility/crash-determining-aria-role-when-label-present.html: * accessibility/crash-with-noelement-selectbox.html: * accessibility/crashing-a-tag-in-map.html: * accessibility/deleting-iframe-destroys-axcache.html: * accessibility/disabled-controls-not-focusable.html: * accessibility/div-within-anchors-causes-crash.html: * accessibility/duplicate-axrenderobject-crash.html: * accessibility/duplicate-child-nodes.html: * accessibility/element-haspopup.html: * accessibility/ellipsis-text.html: * accessibility/empty-image-with-title.html: * accessibility/file-upload-button-with-axpress.html: * accessibility/first-letter-text-transform-causes-crash.html: * accessibility/focusable-div.html: * accessibility/global-aria-attributes-invalidate-presentational.html: * accessibility/hang-in-isignored.html: * accessibility/heading-level.html: * accessibility/heading-title-includes-links.html: * accessibility/hidden-legend.html: * accessibility/html-html-element-is-ignored.html: * accessibility/html5-required-attribute.html: * accessibility/iframe-bastardization.html: * accessibility/image-map-title-causes-crash.html: * accessibility/image-map-update-parent-crash.html: * accessibility/image-map1.html: * accessibility/img-alt-tag-only-whitespace.html: * accessibility/img-aria-button-alt-tag.html: * accessibility/img-fallsback-to-title.html: * accessibility/inline-continuations.html: * accessibility/input-file-causes-crash.html: * accessibility/input-image-alt.html: * accessibility/insert-selected-option-into-select-causes-crash.html: * accessibility/label-element-press.html: * accessibility/label-for-control-hittest.html: * accessibility/legend.html: * accessibility/link-inside-button-accessible-text.html: * accessibility/listbox-enabled-states.html: * accessibility/loading-iframe-sends-notification.html: * accessibility/loading-iframe-updates-axtree.html: * accessibility/media-controls.html: * accessibility/media-element.html: * accessibility/menu-item-crash.html: * accessibility/menu-list-sends-change-notification.html: * accessibility/meter-element.html: * accessibility/multiselect-list-reports-active-option.html: * accessibility/non-native-image-crash.html: * accessibility/noscript-ignored.html: * accessibility/notification-listeners.html: * accessibility/placeholder.html: * accessibility/platform-name.html: * accessibility/poorly-formed-aria-table.html: * accessibility/popup-button-title.html: * accessibility/presentational-elements-with-focus.html: * accessibility/press-works-on-control-types.html: * accessibility/radio-button-title-label.html: * accessibility/removed-anonymous-block-child-causes-crash.html: * accessibility/removed-continuation-element-causes-crash.html: * accessibility/render-counter-text.html: * accessibility/selection-states.html: * accessibility/spinbutton-value.html: * accessibility/svg-bounds.html: * accessibility/svg-group-element-with-title.html: * accessibility/svg-image.html: * accessibility/svg-remote-element.html: * accessibility/table-cell-for-column-and-row-crash.html: * accessibility/table-destroyed-crash.html: * accessibility/table-remove-cell-crash.html: * accessibility/table-with-empty-thead-causes-crash.html: * accessibility/table-with-hidden-head-section.html: * accessibility/table-with-mismatch-column-count-in-initial-section.html: * accessibility/text-role-with-aria-hidden-inside.html: * accessibility/textarea-insertion-point-line-number.html: * accessibility/textbox-role-reports-selection.html: * accessibility/title-ui-element-correctness.html: * accessibility/transformed-bounds.html: * accessibility/updating-attribute-in-table-causes-crash.html: * animations/animation-css-rule-types.html: * animations/animation-events-create.html: * animations/computed-style.html: * animations/keyframes-rule.html: * animations/script-tests/TEMPLATE.html: * batterystatus/add-listener-from-callback.html: * batterystatus/basic-all-types-of-events.html: * batterystatus/basic-operation.html: * batterystatus/event-after-navigation.html: * batterystatus/multiple-frames.html: * batterystatus/updates.html: * batterystatus/window-property.html: Canonical link: https://commits.webkit.org/138878@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-09-08 01:18:24 +00:00
<script src="../resources/js-test-pre.js"></script>
AX: Layout tests related to text alternative computation need to be done differently https://bugs.webkit.org/show_bug.cgi?id=157187 Create several utility methods to facilitate retrieval of platform-independent attribute values from platform-specific attributes: - platformValueForW3CName() and platformValueForW3CDescription() to retrieve a specific piece of text alternative information, stripping off the platform attribute name by default. These methods should make it possible to share tests and expectations files because the text alternative calculation defined by the W3C accessibility specifications should be the same for all platforms. (The differences are the result of the unique platform mappings.) - platformTextAlternatives() to dump out all the text alternative attributes and values, preserving the platform-specific attribute name. This, along with the use of the platformValue* methods with attribute name enabled, should make it possible to have shared tests with platform-specific expectations without the need to check the platform in the test itself. - platformRoleForComboBox() and platformRoleForStaticText() to eliminate the need for platform-specific expectations files simply because such an element happens to be included in the test file and verifying that element's role is desired. Begin using these methods in the tests related to text alternative computation which had platform-specific checks, update the expectations files when needed, and remove now-obsolete platform-specific expectations files. Reviewed by Chris Fleizach. * accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Updated. * accessibility/alt-tag-on-image-with-nonimage-role.html: Updated. * accessibility/aria-help-expected.txt: Added. * accessibility/aria-help.html: Updated. * accessibility/aria-label-expected.txt: Updated. * accessibility/aria-label.html: Updated. * accessibility/aria-labeled-with-hidden-node-expected.txt: Updated. * accessibility/aria-labeled-with-hidden-node.html: Updated. * accessibility/aria-labelledby-on-input-expected.txt: Updated. * accessibility/aria-labelledby-on-input.html: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby.html: Updated. * accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * accessibility/aria-labelledby-overrides-label.html: Updated. * accessibility/aria-labelledby-stay-within-expected.txt: Updated. * accessibility/aria-labelledby-stay-within.html: Updated. * accessibility/aria-labelledby-with-descendants-expected.txt: Updated. * accessibility/aria-labelledby-with-descendants.html: Updated. * accessibility/aria-namefrom-author-expected.txt: Updated. * accessibility/aria-namefrom-author.html: Updated. * accessibility/aria-text-role-expected.txt: Updated. * accessibility/aria-text-role.html: Updated. * accessibility/canvas-description-and-role-expected.txt: Updated. * accessibility/canvas-description-and-role.html: Updated. * accessibility/canvas-fallback-content.html: Updated. * accessibility/empty-image-with-title-expected.txt: Updated. * accessibility/empty-image-with-title.html: Updated. * accessibility/fieldset-element-expected.txt: Updated. * accessibility/fieldset-element.html: Updated. * accessibility/focusable-div-expected.txt: Updated. * accessibility/focusable-div.html: Updated. * accessibility/help-text.html: Updated. * accessibility/img-alt-tag-only-whitespace-expected.txt: Updated. * accessibility/img-alt-tag-only-whitespace.html: Updated. * accessibility/img-aria-button-alt-tag-expected.txt: Updated. * accessibility/img-aria-button-alt-tag.html: Updated. * accessibility/img-fallsback-to-title.html: Updated. * accessibility/input-image-alt-expected.txt: Updated. * accessibility/input-image-alt.html: Updated. * accessibility/loading-iframe-sends-notification.html: Updated. * accessibility/self-referencing-aria-labelledby-expected.txt: Updated. * accessibility/self-referencing-aria-labelledby.html: Updated. * accessibility/svg-bounds.html: Updated. * accessibility/svg-group-element-with-title-expected.txt: Updated. * accessibility/svg-group-element-with-title.html: Updated. * accessibility/svg-image-expected.txt: Updated. * accessibility/svg-image.html: Updated. * accessibility/svg-labelledby-expected.txt: Updated. * accessibility/svg-labelledby.html: Updated. * accessibility/svg-remote-element.html: Updated. * accessibility/w3c-svg-description-calculation.html: Updated. * accessibility/w3c-svg-name-calculation.html: Updated. * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Removed. * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Removed. * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Removed. * platform/gtk/accessibility/aria-text-role-expected.txt: Removed. * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/gtk/accessibility/empty-image-with-title-expected.txt: Updated. * platform/gtk/accessibility/fieldset-element-expected.txt: Removed. * platform/gtk/accessibility/focusable-div-expected.txt: Removed. * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Removed. * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Removed. * platform/gtk/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/gtk/accessibility/input-image-alt-expected.txt: Removed. * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Removed. * platform/gtk/accessibility/svg-group-element-with-title-expected.txt: Removed. * platform/gtk/accessibility/svg-image-expected.txt: Removed. * platform/gtk/accessibility/svg-labelledby-expected.txt: Removed. * platform/mac/accessibility/aria-help-expected.txt: Removed. * platform/mac/accessibility/aria-labelledby-overrides-label-expected.txt: Removed. * platform/mac/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/mac/accessibility/fieldset-element-expected.txt: Removed. * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/win/accessibility/canvas-description-and-role-expected.txt: Updated. * resources/accessibility-helper.js: (platformValueForW3CName): Added. (platformValueForW3CDescription): Added. (platformTextAlternatives): Added. (platformRoleForComboBox): Added. (platformRoleForStaticText): Added. Canonical link: https://commits.webkit.org/176061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-20 18:34:14 +00:00
<script src="../resources/accessibility-helper.js"></script>
<div id="content">
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
AX: textUnderElement should consider alt text, but skip links and controls https://bugs.webkit.org/show_bug.cgi?id=101650 Reviewed by Chris Fleizach. Source/WebCore: Getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. The computation of textUnderElement is now recursive and doesn't depend on text iterators, which might not do the right thing for accessibility anyways. For GTK, the old behavior is retained so that support for the object replacement character is still there. Filed a new bug (105214) for GTK folks to look at this. Test: accessibility/button-title-uses-inner-img-alt.html Test: accessibility/focusable-div.html * accessibility/AccessibilityNodeObject.cpp: (WebCore): (WebCore::shouldUseAccessiblityObjectInnerText): (WebCore::AccessibilityNodeObject::textUnderElement): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): LayoutTests: Adds new tests to show that getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. Updates and rebaselines several tests to reflect the new logic. Skips these tests on GTK until support for the object replacement character can be added. * accessibility/button-title-uses-inner-img-alt-expected.txt: Added. * accessibility/button-title-uses-inner-img-alt.html: Added. * accessibility/focusable-div-expected.txt: Extended with more test cases. * accessibility/focusable-div.html: Extended with more test cases. * platform/chromium/TestExpectations: Un-skip test that now passes. * platform/chromium/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/internal-link-anchors2-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element.html: Fix * platform/mac/accessibility/table-with-aria-role-expected.txt: Rebaseline * platform/gtk/TestExpectations: Skip these tests until this feature is implemented for GTK. Canonical link: https://commits.webkit.org/123457@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-12-17 22:24:03 +00:00
<!-- A link always gets its accessible text from contents. -->
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
<a id="link" href="#">A</a>
AX: textUnderElement should consider alt text, but skip links and controls https://bugs.webkit.org/show_bug.cgi?id=101650 Reviewed by Chris Fleizach. Source/WebCore: Getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. The computation of textUnderElement is now recursive and doesn't depend on text iterators, which might not do the right thing for accessibility anyways. For GTK, the old behavior is retained so that support for the object replacement character is still there. Filed a new bug (105214) for GTK folks to look at this. Test: accessibility/button-title-uses-inner-img-alt.html Test: accessibility/focusable-div.html * accessibility/AccessibilityNodeObject.cpp: (WebCore): (WebCore::shouldUseAccessiblityObjectInnerText): (WebCore::AccessibilityNodeObject::textUnderElement): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): LayoutTests: Adds new tests to show that getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. Updates and rebaselines several tests to reflect the new logic. Skips these tests on GTK until support for the object replacement character can be added. * accessibility/button-title-uses-inner-img-alt-expected.txt: Added. * accessibility/button-title-uses-inner-img-alt.html: Added. * accessibility/focusable-div-expected.txt: Extended with more test cases. * accessibility/focusable-div.html: Extended with more test cases. * platform/chromium/TestExpectations: Un-skip test that now passes. * platform/chromium/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/internal-link-anchors2-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element.html: Fix * platform/mac/accessibility/table-with-aria-role-expected.txt: Rebaseline * platform/gtk/TestExpectations: Skip these tests until this feature is implemented for GTK. Canonical link: https://commits.webkit.org/123457@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-12-17 22:24:03 +00:00
<!-- A generic focusable div should not get its accessible text from contents. -->
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
<div id="div" tabindex="0">B</div>
<div id="div2" tabindex="0"><div></div>C</div>
<div id="div3" tabindex="0" aria-label="D"></div>
AX: textUnderElement should consider alt text, but skip links and controls https://bugs.webkit.org/show_bug.cgi?id=101650 Reviewed by Chris Fleizach. Source/WebCore: Getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. The computation of textUnderElement is now recursive and doesn't depend on text iterators, which might not do the right thing for accessibility anyways. For GTK, the old behavior is retained so that support for the object replacement character is still there. Filed a new bug (105214) for GTK folks to look at this. Test: accessibility/button-title-uses-inner-img-alt.html Test: accessibility/focusable-div.html * accessibility/AccessibilityNodeObject.cpp: (WebCore): (WebCore::shouldUseAccessiblityObjectInnerText): (WebCore::AccessibilityNodeObject::textUnderElement): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): LayoutTests: Adds new tests to show that getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. Updates and rebaselines several tests to reflect the new logic. Skips these tests on GTK until support for the object replacement character can be added. * accessibility/button-title-uses-inner-img-alt-expected.txt: Added. * accessibility/button-title-uses-inner-img-alt.html: Added. * accessibility/focusable-div-expected.txt: Extended with more test cases. * accessibility/focusable-div.html: Extended with more test cases. * platform/chromium/TestExpectations: Un-skip test that now passes. * platform/chromium/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/internal-link-anchors2-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element.html: Fix * platform/mac/accessibility/table-with-aria-role-expected.txt: Rebaseline * platform/gtk/TestExpectations: Skip these tests until this feature is implemented for GTK. Canonical link: https://commits.webkit.org/123457@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-12-17 22:24:03 +00:00
<!-- A generic focusable div should not get accessible text from children that are focusable or containers. -->
<div id="div4" tabindex="0"><a href="#">Link</a></div>
<div id="div5" tabindex="0">Initial text before link<a href="#">Link</a></div>
<div id="div6" tabindex="0"><ul><li>List item</li></ul></div>
<div id="div7" tabindex="0">Initial text before list<ul><li>List item</li></ul></div>
AX: Layout tests related to text alternative computation need to be done differently https://bugs.webkit.org/show_bug.cgi?id=157187 Create several utility methods to facilitate retrieval of platform-independent attribute values from platform-specific attributes: - platformValueForW3CName() and platformValueForW3CDescription() to retrieve a specific piece of text alternative information, stripping off the platform attribute name by default. These methods should make it possible to share tests and expectations files because the text alternative calculation defined by the W3C accessibility specifications should be the same for all platforms. (The differences are the result of the unique platform mappings.) - platformTextAlternatives() to dump out all the text alternative attributes and values, preserving the platform-specific attribute name. This, along with the use of the platformValue* methods with attribute name enabled, should make it possible to have shared tests with platform-specific expectations without the need to check the platform in the test itself. - platformRoleForComboBox() and platformRoleForStaticText() to eliminate the need for platform-specific expectations files simply because such an element happens to be included in the test file and verifying that element's role is desired. Begin using these methods in the tests related to text alternative computation which had platform-specific checks, update the expectations files when needed, and remove now-obsolete platform-specific expectations files. Reviewed by Chris Fleizach. * accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Updated. * accessibility/alt-tag-on-image-with-nonimage-role.html: Updated. * accessibility/aria-help-expected.txt: Added. * accessibility/aria-help.html: Updated. * accessibility/aria-label-expected.txt: Updated. * accessibility/aria-label.html: Updated. * accessibility/aria-labeled-with-hidden-node-expected.txt: Updated. * accessibility/aria-labeled-with-hidden-node.html: Updated. * accessibility/aria-labelledby-on-input-expected.txt: Updated. * accessibility/aria-labelledby-on-input.html: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby.html: Updated. * accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * accessibility/aria-labelledby-overrides-label.html: Updated. * accessibility/aria-labelledby-stay-within-expected.txt: Updated. * accessibility/aria-labelledby-stay-within.html: Updated. * accessibility/aria-labelledby-with-descendants-expected.txt: Updated. * accessibility/aria-labelledby-with-descendants.html: Updated. * accessibility/aria-namefrom-author-expected.txt: Updated. * accessibility/aria-namefrom-author.html: Updated. * accessibility/aria-text-role-expected.txt: Updated. * accessibility/aria-text-role.html: Updated. * accessibility/canvas-description-and-role-expected.txt: Updated. * accessibility/canvas-description-and-role.html: Updated. * accessibility/canvas-fallback-content.html: Updated. * accessibility/empty-image-with-title-expected.txt: Updated. * accessibility/empty-image-with-title.html: Updated. * accessibility/fieldset-element-expected.txt: Updated. * accessibility/fieldset-element.html: Updated. * accessibility/focusable-div-expected.txt: Updated. * accessibility/focusable-div.html: Updated. * accessibility/help-text.html: Updated. * accessibility/img-alt-tag-only-whitespace-expected.txt: Updated. * accessibility/img-alt-tag-only-whitespace.html: Updated. * accessibility/img-aria-button-alt-tag-expected.txt: Updated. * accessibility/img-aria-button-alt-tag.html: Updated. * accessibility/img-fallsback-to-title.html: Updated. * accessibility/input-image-alt-expected.txt: Updated. * accessibility/input-image-alt.html: Updated. * accessibility/loading-iframe-sends-notification.html: Updated. * accessibility/self-referencing-aria-labelledby-expected.txt: Updated. * accessibility/self-referencing-aria-labelledby.html: Updated. * accessibility/svg-bounds.html: Updated. * accessibility/svg-group-element-with-title-expected.txt: Updated. * accessibility/svg-group-element-with-title.html: Updated. * accessibility/svg-image-expected.txt: Updated. * accessibility/svg-image.html: Updated. * accessibility/svg-labelledby-expected.txt: Updated. * accessibility/svg-labelledby.html: Updated. * accessibility/svg-remote-element.html: Updated. * accessibility/w3c-svg-description-calculation.html: Updated. * accessibility/w3c-svg-name-calculation.html: Updated. * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Removed. * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Removed. * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Removed. * platform/gtk/accessibility/aria-text-role-expected.txt: Removed. * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/gtk/accessibility/empty-image-with-title-expected.txt: Updated. * platform/gtk/accessibility/fieldset-element-expected.txt: Removed. * platform/gtk/accessibility/focusable-div-expected.txt: Removed. * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Removed. * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Removed. * platform/gtk/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/gtk/accessibility/input-image-alt-expected.txt: Removed. * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Removed. * platform/gtk/accessibility/svg-group-element-with-title-expected.txt: Removed. * platform/gtk/accessibility/svg-image-expected.txt: Removed. * platform/gtk/accessibility/svg-labelledby-expected.txt: Removed. * platform/mac/accessibility/aria-help-expected.txt: Removed. * platform/mac/accessibility/aria-labelledby-overrides-label-expected.txt: Removed. * platform/mac/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/mac/accessibility/fieldset-element-expected.txt: Removed. * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/win/accessibility/canvas-description-and-role-expected.txt: Updated. * resources/accessibility-helper.js: (platformValueForW3CName): Added. (platformValueForW3CDescription): Added. (platformTextAlternatives): Added. (platformRoleForComboBox): Added. (platformRoleForStaticText): Added. Canonical link: https://commits.webkit.org/176061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-20 18:34:14 +00:00
</div>
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
<div id="console"></div>
<script>
description("This test makes sure that a generic focusable div can get accessibility focus. It should not get accessible text from its children automatically though.");
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
if (window.testRunner && window.accessibilityController) {
window.testRunner.dumpAsText();
function lastChar(str) {
return str.substr(str.length - 1);
}
var link = document.getElementById('link');
link.focus();
shouldBe("document.activeElement == link", "true");
window.axLink = accessibilityController.focusedElement;
shouldBe("lastChar(axLink.title)", "\"A\"");
var div = document.getElementById('div');
div.focus();
shouldBe("document.activeElement == div", "true");
window.axDiv = accessibilityController.focusedElement;
shouldBe("lastChar(axDiv.title)", "' '");
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
var div2 = document.getElementById('div2');
div2.focus();
shouldBe("document.activeElement == div2", "true");
window.axDiv2 = accessibilityController.focusedElement;
shouldBe("lastChar(axDiv2.title)", "' '");
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
var div3 = document.getElementById('div3');
div3.focus();
shouldBe("document.activeElement == div3", "true");
window.axDiv3 = accessibilityController.focusedElement;
AX: Layout tests related to text alternative computation need to be done differently https://bugs.webkit.org/show_bug.cgi?id=157187 Create several utility methods to facilitate retrieval of platform-independent attribute values from platform-specific attributes: - platformValueForW3CName() and platformValueForW3CDescription() to retrieve a specific piece of text alternative information, stripping off the platform attribute name by default. These methods should make it possible to share tests and expectations files because the text alternative calculation defined by the W3C accessibility specifications should be the same for all platforms. (The differences are the result of the unique platform mappings.) - platformTextAlternatives() to dump out all the text alternative attributes and values, preserving the platform-specific attribute name. This, along with the use of the platformValue* methods with attribute name enabled, should make it possible to have shared tests with platform-specific expectations without the need to check the platform in the test itself. - platformRoleForComboBox() and platformRoleForStaticText() to eliminate the need for platform-specific expectations files simply because such an element happens to be included in the test file and verifying that element's role is desired. Begin using these methods in the tests related to text alternative computation which had platform-specific checks, update the expectations files when needed, and remove now-obsolete platform-specific expectations files. Reviewed by Chris Fleizach. * accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Updated. * accessibility/alt-tag-on-image-with-nonimage-role.html: Updated. * accessibility/aria-help-expected.txt: Added. * accessibility/aria-help.html: Updated. * accessibility/aria-label-expected.txt: Updated. * accessibility/aria-label.html: Updated. * accessibility/aria-labeled-with-hidden-node-expected.txt: Updated. * accessibility/aria-labeled-with-hidden-node.html: Updated. * accessibility/aria-labelledby-on-input-expected.txt: Updated. * accessibility/aria-labelledby-on-input.html: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby.html: Updated. * accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * accessibility/aria-labelledby-overrides-label.html: Updated. * accessibility/aria-labelledby-stay-within-expected.txt: Updated. * accessibility/aria-labelledby-stay-within.html: Updated. * accessibility/aria-labelledby-with-descendants-expected.txt: Updated. * accessibility/aria-labelledby-with-descendants.html: Updated. * accessibility/aria-namefrom-author-expected.txt: Updated. * accessibility/aria-namefrom-author.html: Updated. * accessibility/aria-text-role-expected.txt: Updated. * accessibility/aria-text-role.html: Updated. * accessibility/canvas-description-and-role-expected.txt: Updated. * accessibility/canvas-description-and-role.html: Updated. * accessibility/canvas-fallback-content.html: Updated. * accessibility/empty-image-with-title-expected.txt: Updated. * accessibility/empty-image-with-title.html: Updated. * accessibility/fieldset-element-expected.txt: Updated. * accessibility/fieldset-element.html: Updated. * accessibility/focusable-div-expected.txt: Updated. * accessibility/focusable-div.html: Updated. * accessibility/help-text.html: Updated. * accessibility/img-alt-tag-only-whitespace-expected.txt: Updated. * accessibility/img-alt-tag-only-whitespace.html: Updated. * accessibility/img-aria-button-alt-tag-expected.txt: Updated. * accessibility/img-aria-button-alt-tag.html: Updated. * accessibility/img-fallsback-to-title.html: Updated. * accessibility/input-image-alt-expected.txt: Updated. * accessibility/input-image-alt.html: Updated. * accessibility/loading-iframe-sends-notification.html: Updated. * accessibility/self-referencing-aria-labelledby-expected.txt: Updated. * accessibility/self-referencing-aria-labelledby.html: Updated. * accessibility/svg-bounds.html: Updated. * accessibility/svg-group-element-with-title-expected.txt: Updated. * accessibility/svg-group-element-with-title.html: Updated. * accessibility/svg-image-expected.txt: Updated. * accessibility/svg-image.html: Updated. * accessibility/svg-labelledby-expected.txt: Updated. * accessibility/svg-labelledby.html: Updated. * accessibility/svg-remote-element.html: Updated. * accessibility/w3c-svg-description-calculation.html: Updated. * accessibility/w3c-svg-name-calculation.html: Updated. * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Removed. * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Removed. * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Removed. * platform/gtk/accessibility/aria-text-role-expected.txt: Removed. * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/gtk/accessibility/empty-image-with-title-expected.txt: Updated. * platform/gtk/accessibility/fieldset-element-expected.txt: Removed. * platform/gtk/accessibility/focusable-div-expected.txt: Removed. * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Removed. * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Removed. * platform/gtk/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/gtk/accessibility/input-image-alt-expected.txt: Removed. * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Removed. * platform/gtk/accessibility/svg-group-element-with-title-expected.txt: Removed. * platform/gtk/accessibility/svg-image-expected.txt: Removed. * platform/gtk/accessibility/svg-labelledby-expected.txt: Removed. * platform/mac/accessibility/aria-help-expected.txt: Removed. * platform/mac/accessibility/aria-labelledby-overrides-label-expected.txt: Removed. * platform/mac/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/mac/accessibility/fieldset-element-expected.txt: Removed. * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/win/accessibility/canvas-description-and-role-expected.txt: Updated. * resources/accessibility-helper.js: (platformValueForW3CName): Added. (platformValueForW3CDescription): Added. (platformTextAlternatives): Added. (platformRoleForComboBox): Added. (platformRoleForStaticText): Added. Canonical link: https://commits.webkit.org/176061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-20 18:34:14 +00:00
var accNameForDiv3 = platformValueForW3CName(axDiv3);
shouldBe("lastChar(accNameForDiv3)", "\"D\"");
AX: textUnderElement should consider alt text, but skip links and controls https://bugs.webkit.org/show_bug.cgi?id=101650 Reviewed by Chris Fleizach. Source/WebCore: Getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. The computation of textUnderElement is now recursive and doesn't depend on text iterators, which might not do the right thing for accessibility anyways. For GTK, the old behavior is retained so that support for the object replacement character is still there. Filed a new bug (105214) for GTK folks to look at this. Test: accessibility/button-title-uses-inner-img-alt.html Test: accessibility/focusable-div.html * accessibility/AccessibilityNodeObject.cpp: (WebCore): (WebCore::shouldUseAccessiblityObjectInnerText): (WebCore::AccessibilityNodeObject::textUnderElement): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): LayoutTests: Adds new tests to show that getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. Updates and rebaselines several tests to reflect the new logic. Skips these tests on GTK until support for the object replacement character can be added. * accessibility/button-title-uses-inner-img-alt-expected.txt: Added. * accessibility/button-title-uses-inner-img-alt.html: Added. * accessibility/focusable-div-expected.txt: Extended with more test cases. * accessibility/focusable-div.html: Extended with more test cases. * platform/chromium/TestExpectations: Un-skip test that now passes. * platform/chromium/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/internal-link-anchors2-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element.html: Fix * platform/mac/accessibility/table-with-aria-role-expected.txt: Rebaseline * platform/gtk/TestExpectations: Skip these tests until this feature is implemented for GTK. Canonical link: https://commits.webkit.org/123457@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-12-17 22:24:03 +00:00
var div4 = document.getElementById('div4');
div4.focus();
shouldBe("document.activeElement == div4", "true");
window.axDiv4 = accessibilityController.focusedElement;
shouldBe("axDiv4.title.indexOf('Link')", "-1");
var div5 = document.getElementById('div5');
div5.focus();
shouldBe("document.activeElement == div5", "true");
window.axDiv5 = accessibilityController.focusedElement;
shouldBe("axDiv5.title.indexOf('Link')", "-1");
shouldBe("axDiv5.title.indexOf('Initial text before link') >= 0", "false");
AX: textUnderElement should consider alt text, but skip links and controls https://bugs.webkit.org/show_bug.cgi?id=101650 Reviewed by Chris Fleizach. Source/WebCore: Getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. The computation of textUnderElement is now recursive and doesn't depend on text iterators, which might not do the right thing for accessibility anyways. For GTK, the old behavior is retained so that support for the object replacement character is still there. Filed a new bug (105214) for GTK folks to look at this. Test: accessibility/button-title-uses-inner-img-alt.html Test: accessibility/focusable-div.html * accessibility/AccessibilityNodeObject.cpp: (WebCore): (WebCore::shouldUseAccessiblityObjectInnerText): (WebCore::AccessibilityNodeObject::textUnderElement): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): LayoutTests: Adds new tests to show that getting inner text from an element now ignores focusable descendants and containers, but uses alternative text. Updates and rebaselines several tests to reflect the new logic. Skips these tests on GTK until support for the object replacement character can be added. * accessibility/button-title-uses-inner-img-alt-expected.txt: Added. * accessibility/button-title-uses-inner-img-alt.html: Added. * accessibility/focusable-div-expected.txt: Extended with more test cases. * accessibility/focusable-div.html: Extended with more test cases. * platform/chromium/TestExpectations: Un-skip test that now passes. * platform/chromium/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/image-link-expected.txt: Rebaseline * platform/mac/accessibility/internal-link-anchors2-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element-expected.txt: Rebaseline * platform/mac/accessibility/static-text-role-uses-text-under-element.html: Fix * platform/mac/accessibility/table-with-aria-role-expected.txt: Rebaseline * platform/gtk/TestExpectations: Skip these tests until this feature is implemented for GTK. Canonical link: https://commits.webkit.org/123457@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137946 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-12-17 22:24:03 +00:00
var div6 = document.getElementById('div6');
div6.focus();
shouldBe("document.activeElement == div6", "true");
window.axDiv6 = accessibilityController.focusedElement;
shouldBe("axDiv6.title.indexOf('List item')", "-1");
var div7 = document.getElementById('div7');
div7.focus();
shouldBe("document.activeElement == div7", "true");
window.axDiv7 = accessibilityController.focusedElement;
shouldBe("axDiv7.title.indexOf('List item')", "-1");
shouldBe("axDiv7.title.indexOf('Initial text before list') >= 0", "false");
AX: Layout tests related to text alternative computation need to be done differently https://bugs.webkit.org/show_bug.cgi?id=157187 Create several utility methods to facilitate retrieval of platform-independent attribute values from platform-specific attributes: - platformValueForW3CName() and platformValueForW3CDescription() to retrieve a specific piece of text alternative information, stripping off the platform attribute name by default. These methods should make it possible to share tests and expectations files because the text alternative calculation defined by the W3C accessibility specifications should be the same for all platforms. (The differences are the result of the unique platform mappings.) - platformTextAlternatives() to dump out all the text alternative attributes and values, preserving the platform-specific attribute name. This, along with the use of the platformValue* methods with attribute name enabled, should make it possible to have shared tests with platform-specific expectations without the need to check the platform in the test itself. - platformRoleForComboBox() and platformRoleForStaticText() to eliminate the need for platform-specific expectations files simply because such an element happens to be included in the test file and verifying that element's role is desired. Begin using these methods in the tests related to text alternative computation which had platform-specific checks, update the expectations files when needed, and remove now-obsolete platform-specific expectations files. Reviewed by Chris Fleizach. * accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Updated. * accessibility/alt-tag-on-image-with-nonimage-role.html: Updated. * accessibility/aria-help-expected.txt: Added. * accessibility/aria-help.html: Updated. * accessibility/aria-label-expected.txt: Updated. * accessibility/aria-label.html: Updated. * accessibility/aria-labeled-with-hidden-node-expected.txt: Updated. * accessibility/aria-labeled-with-hidden-node.html: Updated. * accessibility/aria-labelledby-on-input-expected.txt: Updated. * accessibility/aria-labelledby-on-input.html: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby.html: Updated. * accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * accessibility/aria-labelledby-overrides-label.html: Updated. * accessibility/aria-labelledby-stay-within-expected.txt: Updated. * accessibility/aria-labelledby-stay-within.html: Updated. * accessibility/aria-labelledby-with-descendants-expected.txt: Updated. * accessibility/aria-labelledby-with-descendants.html: Updated. * accessibility/aria-namefrom-author-expected.txt: Updated. * accessibility/aria-namefrom-author.html: Updated. * accessibility/aria-text-role-expected.txt: Updated. * accessibility/aria-text-role.html: Updated. * accessibility/canvas-description-and-role-expected.txt: Updated. * accessibility/canvas-description-and-role.html: Updated. * accessibility/canvas-fallback-content.html: Updated. * accessibility/empty-image-with-title-expected.txt: Updated. * accessibility/empty-image-with-title.html: Updated. * accessibility/fieldset-element-expected.txt: Updated. * accessibility/fieldset-element.html: Updated. * accessibility/focusable-div-expected.txt: Updated. * accessibility/focusable-div.html: Updated. * accessibility/help-text.html: Updated. * accessibility/img-alt-tag-only-whitespace-expected.txt: Updated. * accessibility/img-alt-tag-only-whitespace.html: Updated. * accessibility/img-aria-button-alt-tag-expected.txt: Updated. * accessibility/img-aria-button-alt-tag.html: Updated. * accessibility/img-fallsback-to-title.html: Updated. * accessibility/input-image-alt-expected.txt: Updated. * accessibility/input-image-alt.html: Updated. * accessibility/loading-iframe-sends-notification.html: Updated. * accessibility/self-referencing-aria-labelledby-expected.txt: Updated. * accessibility/self-referencing-aria-labelledby.html: Updated. * accessibility/svg-bounds.html: Updated. * accessibility/svg-group-element-with-title-expected.txt: Updated. * accessibility/svg-group-element-with-title.html: Updated. * accessibility/svg-image-expected.txt: Updated. * accessibility/svg-image.html: Updated. * accessibility/svg-labelledby-expected.txt: Updated. * accessibility/svg-labelledby.html: Updated. * accessibility/svg-remote-element.html: Updated. * accessibility/w3c-svg-description-calculation.html: Updated. * accessibility/w3c-svg-name-calculation.html: Updated. * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Removed. * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Removed. * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Removed. * platform/gtk/accessibility/aria-text-role-expected.txt: Removed. * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/gtk/accessibility/empty-image-with-title-expected.txt: Updated. * platform/gtk/accessibility/fieldset-element-expected.txt: Removed. * platform/gtk/accessibility/focusable-div-expected.txt: Removed. * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Removed. * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Removed. * platform/gtk/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/gtk/accessibility/input-image-alt-expected.txt: Removed. * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Removed. * platform/gtk/accessibility/svg-group-element-with-title-expected.txt: Removed. * platform/gtk/accessibility/svg-image-expected.txt: Removed. * platform/gtk/accessibility/svg-labelledby-expected.txt: Removed. * platform/mac/accessibility/aria-help-expected.txt: Removed. * platform/mac/accessibility/aria-labelledby-overrides-label-expected.txt: Removed. * platform/mac/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/mac/accessibility/fieldset-element-expected.txt: Removed. * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/win/accessibility/canvas-description-and-role-expected.txt: Updated. * resources/accessibility-helper.js: (platformValueForW3CName): Added. (platformValueForW3CDescription): Added. (platformTextAlternatives): Added. (platformRoleForComboBox): Added. (platformRoleForStaticText): Added. Canonical link: https://commits.webkit.org/176061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-20 18:34:14 +00:00
document.getElementById("content").style.visibility = "hidden";
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
}
</script>
Change LayoutTests' a* and b* files to use pre and post js files in LayoutTests/resources. https://bugs.webkit.org/show_bug.cgi?id=120985. Rubber stamped by Filip Pizlo. * accessibility/accessibility-node-memory-management.html: * accessibility/accessibility-node-reparent.html: * accessibility/accessibility-object-detached.html: * accessibility/adjacent-continuations-cause-assertion-failure.html: * accessibility/anonymous-render-block-in-continuation-causes-crash.html: * accessibility/aria-checkbox-checked.html: * accessibility/aria-checkbox-sends-notification.html: * accessibility/aria-checkbox-text.html: * accessibility/aria-combobox.html: * accessibility/aria-controls-with-tabs.html: * accessibility/aria-disabled.html: * accessibility/aria-fallback-roles.html: * accessibility/aria-help.html: * accessibility/aria-hidden-hides-all-elements.html: * accessibility/aria-hidden-update.html: * accessibility/aria-hidden-updates-alldescendants.html: * accessibility/aria-hidden-with-elements.html: * accessibility/aria-hidden.html: * accessibility/aria-invalid.html: * accessibility/aria-label.html: * accessibility/aria-labelledby-overrides-label.html: * accessibility/aria-list-and-listitem.html: * accessibility/aria-menubar-menuitems.html: * accessibility/aria-option-role.html: * accessibility/aria-presentational-role.html: * accessibility/aria-readonly.html: * accessibility/aria-required.html: * accessibility/aria-scrollbar-role.html: * accessibility/aria-sort.html: * accessibility/aria-tab-role-on-buttons.html: * accessibility/aria-tab-roles.html: * accessibility/aria-text-role.html: * accessibility/aria-toggle-button-with-title.html: * accessibility/aria-used-on-image-maps.html: * accessibility/button-title-uses-inner-img-alt.html: * accessibility/canvas-accessibilitynodeobject.html: * accessibility/canvas-description-and-role.html: * accessibility/canvas-fallback-content-2.html: * accessibility/canvas-fallback-content.html: * accessibility/color-well.html: * accessibility/container-node-delete-causes-crash.html: * accessibility/content-changed-notification-causes-crash.html: * accessibility/contenteditable-hidden-div.html: * accessibility/contenteditable-table-check-causes-crash.html: * accessibility/corresponding-control-deleted-crash.html: * accessibility/crash-adopt-node-from-new-document.html: * accessibility/crash-determining-aria-role-when-label-present.html: * accessibility/crash-with-noelement-selectbox.html: * accessibility/crashing-a-tag-in-map.html: * accessibility/deleting-iframe-destroys-axcache.html: * accessibility/disabled-controls-not-focusable.html: * accessibility/div-within-anchors-causes-crash.html: * accessibility/duplicate-axrenderobject-crash.html: * accessibility/duplicate-child-nodes.html: * accessibility/element-haspopup.html: * accessibility/ellipsis-text.html: * accessibility/empty-image-with-title.html: * accessibility/file-upload-button-with-axpress.html: * accessibility/first-letter-text-transform-causes-crash.html: * accessibility/focusable-div.html: * accessibility/global-aria-attributes-invalidate-presentational.html: * accessibility/hang-in-isignored.html: * accessibility/heading-level.html: * accessibility/heading-title-includes-links.html: * accessibility/hidden-legend.html: * accessibility/html-html-element-is-ignored.html: * accessibility/html5-required-attribute.html: * accessibility/iframe-bastardization.html: * accessibility/image-map-title-causes-crash.html: * accessibility/image-map-update-parent-crash.html: * accessibility/image-map1.html: * accessibility/img-alt-tag-only-whitespace.html: * accessibility/img-aria-button-alt-tag.html: * accessibility/img-fallsback-to-title.html: * accessibility/inline-continuations.html: * accessibility/input-file-causes-crash.html: * accessibility/input-image-alt.html: * accessibility/insert-selected-option-into-select-causes-crash.html: * accessibility/label-element-press.html: * accessibility/label-for-control-hittest.html: * accessibility/legend.html: * accessibility/link-inside-button-accessible-text.html: * accessibility/listbox-enabled-states.html: * accessibility/loading-iframe-sends-notification.html: * accessibility/loading-iframe-updates-axtree.html: * accessibility/media-controls.html: * accessibility/media-element.html: * accessibility/menu-item-crash.html: * accessibility/menu-list-sends-change-notification.html: * accessibility/meter-element.html: * accessibility/multiselect-list-reports-active-option.html: * accessibility/non-native-image-crash.html: * accessibility/noscript-ignored.html: * accessibility/notification-listeners.html: * accessibility/placeholder.html: * accessibility/platform-name.html: * accessibility/poorly-formed-aria-table.html: * accessibility/popup-button-title.html: * accessibility/presentational-elements-with-focus.html: * accessibility/press-works-on-control-types.html: * accessibility/radio-button-title-label.html: * accessibility/removed-anonymous-block-child-causes-crash.html: * accessibility/removed-continuation-element-causes-crash.html: * accessibility/render-counter-text.html: * accessibility/selection-states.html: * accessibility/spinbutton-value.html: * accessibility/svg-bounds.html: * accessibility/svg-group-element-with-title.html: * accessibility/svg-image.html: * accessibility/svg-remote-element.html: * accessibility/table-cell-for-column-and-row-crash.html: * accessibility/table-destroyed-crash.html: * accessibility/table-remove-cell-crash.html: * accessibility/table-with-empty-thead-causes-crash.html: * accessibility/table-with-hidden-head-section.html: * accessibility/table-with-mismatch-column-count-in-initial-section.html: * accessibility/text-role-with-aria-hidden-inside.html: * accessibility/textarea-insertion-point-line-number.html: * accessibility/textbox-role-reports-selection.html: * accessibility/title-ui-element-correctness.html: * accessibility/transformed-bounds.html: * accessibility/updating-attribute-in-table-causes-crash.html: * animations/animation-css-rule-types.html: * animations/animation-events-create.html: * animations/computed-style.html: * animations/keyframes-rule.html: * animations/script-tests/TEMPLATE.html: * batterystatus/add-listener-from-callback.html: * batterystatus/basic-all-types-of-events.html: * batterystatus/basic-operation.html: * batterystatus/event-after-navigation.html: * batterystatus/multiple-frames.html: * batterystatus/updates.html: * batterystatus/window-property.html: Canonical link: https://commits.webkit.org/138878@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-09-08 01:18:24 +00:00
<script src="../resources/js-test-post.js"></script>
AX: Focusable elements without a role should not be ignored https://bugs.webkit.org/show_bug.cgi?id=94302 Reviewed by Chris Fleizach. Source/WebCore: Changes the accessibility logic so that a generic element that's focusable is not ignored for accessibility, and returns its inner text as its title. That way if you Tab to the element, a reasonable accessibility notification is generated. One exception is the body element, because focusing the body is equivalent to blurring the current focused element and does not result in a "focus" accessibility notification. Also fixes logic that determined if an element was contentEditable by making sure it catches the case with no attribute value (e.g. <div contentEditable>), which also implies contentEditable=true according to the spec. Test: accessibility/focusable-div.html * accessibility/AccessibilityRenderObject.cpp: (WebCore): (WebCore::nodeHasContentEditableAttributeSet): (WebCore::AccessibilityRenderObject::title): (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): LayoutTests: Adds a new test to make sure that a generic focusable element (like a div with tabindex=0) can get focus and return an appropriate title, just like a form control or element with an ARIA role. Modifies three existing tests that were previously assuming that a focusable node with no role would be ignored for accessibility ("accessibilityIsIgnored"). * accessibility/editable-webarea-context-menu-point.html: * accessibility/focusable-div-expected.txt: Added. * accessibility/focusable-div.html: Added. * accessibility/table-detection.html: * platform/mac/accessibility/listbox-hit-test.html: Canonical link: https://commits.webkit.org/113145@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-08-29 07:56:45 +00:00
</body>
</html>