Skip to content

Commit

Permalink
AX: Update list heuristics to include linked lists inside navigation …
Browse files Browse the repository at this point in the history
…containers

https://bugs.webkit.org/show_bug.cgi?id=193382
<rdar://problem/47233475>

Reviewed by Zalan Bujtas.

Source/WebCore:

If an unstyled list is inside a <nav> or a role=navigation, it should be marked
as an accessibility list.

Updated test: accessibility/list-detection2.html

* accessibility/AccessibilityList.cpp:
(WebCore::AccessibilityList::determineAccessibilityRole):

LayoutTests:

* accessibility/list-detection2-expected.txt:
* accessibility/list-detection2.html:


Canonical link: https://commits.webkit.org/232532@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fleizach committed Dec 16, 2020
1 parent ea6c682 commit d7d152e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
11 changes: 11 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
2020-12-16 Chris Fleizach <cfleizach@apple.com>

AX: Update list heuristics to include linked lists inside navigation containers
https://bugs.webkit.org/show_bug.cgi?id=193382
<rdar://problem/47233475>

Reviewed by Zalan Bujtas.

* accessibility/list-detection2-expected.txt:
* accessibility/list-detection2.html:

2020-12-16 Zalan Bujtas <zalan@apple.com>

[LFC][BFC] Non-quantitative values such as auto and min-content are not influenced by the box-sizing property
Expand Down
2 changes: 2 additions & 0 deletions LayoutTests/accessibility/list-detection2-expected.txt
Expand Up @@ -17,6 +17,8 @@ PASS: ul w/ bullet content on ::before -> list.
PASS: ul w/ bullet content on inline ::before -> list.
PASS: ol w/ counter content on ::before -> list.
PASS: ol w/ counter content on inline ::before -> list.
PASS: ul list in a navigation role -> list.
PASS: ol list in a nav element -> list.
PASS: ul w/ background image (NOT A LIST) -> .
PASS: ul w/ background on ::before (NOT A LIST) -> .
PASS: ul w/o explicit role and displayed inline, which defaults to no markers (NOT A LIST) -> .
Expand Down
18 changes: 18 additions & 0 deletions LayoutTests/accessibility/list-detection2.html
Expand Up @@ -113,6 +113,24 @@ <h1>list because these list markers consist of CSS-generated content on ::before
<li>bar</li>
<li>baz</li>
</ol>
<div role="navigation">
<div>
<ul data-role="list" class="ex nomarkers" style="list-style-type:none" data-note=" list in a navigation role">
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ul>
</div>
</div>
<nav>
<div>
<ol data-role="list" class="ex nomarkers" style="list-style-type:none" data-note=" list in a nav element">
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ol>
</div>
</nav>

<p>Since many web pages suffer from "list-itis" and some users have noted that they don't want to hear about so many lists, any UL or OL that does not match one of the above heuristics should not be exposed as a list. Chances are that they are just presentational lists using the elements for the sake of a styling hook.</p>

Expand Down
16 changes: 16 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
2020-12-16 Chris Fleizach <cfleizach@apple.com>

AX: Update list heuristics to include linked lists inside navigation containers
https://bugs.webkit.org/show_bug.cgi?id=193382
<rdar://problem/47233475>

Reviewed by Zalan Bujtas.

If an unstyled list is inside a <nav> or a role=navigation, it should be marked
as an accessibility list.

Updated test: accessibility/list-detection2.html

* accessibility/AccessibilityList.cpp:
(WebCore::AccessibilityList::determineAccessibilityRole):

2020-12-16 Simon Fraser <simon.fraser@apple.com>

Make FrameView::m_customSizeForResizeEvent an Optional<IntSize>
Expand Down
11 changes: 8 additions & 3 deletions Source/WebCore/accessibility/AccessibilityList.cpp
Expand Up @@ -179,14 +179,19 @@ AccessibilityRole AccessibilityList::determineAccessibilityRole()
}
}
}

// Non <ul> lists and ARIA lists only need to have one child.
// <ul>, <ol> lists need to have visible markers.
if (ariaRoleAttribute() != AccessibilityRole::Unknown) {
if (!listItemCount)
role = AccessibilityRole::ApplicationGroup;
} else if (!hasVisibleMarkers)
role = AccessibilityRole::Group;
} else if (!hasVisibleMarkers) {
// http://webkit.org/b/193382 lists inside of navigation hierarchies should still be considered lists.
if (Accessibility::findAncestor<AXCoreObject>(*this, false, [] (auto& object) { return object.roleValue() == AccessibilityRole::LandmarkNavigation; }))
role = AccessibilityRole::List;
else
role = AccessibilityRole::Group;
}

return role;
}
Expand Down

0 comments on commit d7d152e

Please sign in to comment.