Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav block: remove list markup #31827

Closed
wants to merge 1 commit into from
Closed

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented May 14, 2021

Description

We're shooting ourselves in the foot by making the navigation block markup overly complex. Using lists in navigation elements is not even necessary. It's not because we've always been doing it that way that it is the correct way. I believe the the navigation links will be announced just fine, and if we need to be more descriptive somewhere, we can always add labels (list count and order comes to mind).

Rule of thumb: if you have to completely remove list styling, you should probably not be using lists.

For example, it does make sense to use list if it's a big table of contents of the site, but that's not how this menu will be used I believe.

It's not too late to change since we haven't released the navigation block yet.

While it doesn't really matter if a navigation section uses lists or not, it does matter for us because we're making the navigation overly complex by having to manage the lists. Without lists, you can potentially embed any block in the navigation block without it needing a list item wrapper.

I just removed the list markup here, but otherwise left the structure intact so I don't need to change CSS. However, with the ul element gone, the replacement div should probably be removed in a follow-up.

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@ellatrix ellatrix requested a review from ajitbohra as a code owner May 14, 2021 11:25
@ellatrix ellatrix requested review from mtias, jasmussen and gwwar May 14, 2021 11:25
@github-actions
Copy link

github-actions bot commented May 14, 2021

Size Change: -16.8 kB (-1%)

Total Size: 1.3 MB

Filename Size Change
build/a11y/index.js 1.12 kB +1 B (0%)
build/annotations/index.js 2.93 kB -4 B (0%)
build/api-fetch/index.js 2.42 kB +1 B (0%)
build/blob/index.js 673 B +1 B (0%)
build/block-directory/index.js 6.61 kB +17 B (0%)
build/block-editor/index.js 118 kB +723 B (+1%)
build/block-library/blocks/navigation/editor-rtl.css 1.51 kB -9 B (-1%)
build/block-library/blocks/navigation/editor.css 1.51 kB -9 B (-1%)
build/block-library/blocks/navigation/style-rtl.css 1.68 kB -25 B (-1%)
build/block-library/blocks/navigation/style.css 1.68 kB -29 B (-2%)
build/block-library/blocks/page-list/editor-rtl.css 310 B +71 B (+30%) 🚨
build/block-library/blocks/page-list/editor.css 311 B +71 B (+30%) 🚨
build/block-library/blocks/page-list/style-rtl.css 233 B +29 B (+14%) ⚠️
build/block-library/blocks/page-list/style.css 233 B +29 B (+14%) ⚠️
build/block-library/editor-rtl.css 9.89 kB +54 B (+1%)
build/block-library/editor.css 9.88 kB +52 B (+1%)
build/block-library/index.js 146 kB +2.99 kB (+2%)
build/block-library/style-rtl.css 10.1 kB -10 B (0%)
build/block-library/style.css 10.1 kB -6 B (0%)
build/block-serialization-default-parser/index.js 1.3 kB -1 B (0%)
build/blocks/index.js 47.1 kB +44 B (0%)
build/components/index.js 188 kB +158 B (0%)
build/components/style-rtl.css 16.4 kB +176 B (+1%)
build/components/style.css 16.3 kB +176 B (+1%)
build/compose/index.js 9.92 kB -1 B (0%)
build/core-data/index.js 12.1 kB +7 B (0%)
build/customize-widgets/index.js 5.99 kB -6 B (0%)
build/data-controls/index.js 828 B -1 B (0%)
build/data/index.js 7.23 kB +1 B (0%)
build/deprecated/index.js 739 B +2 B (0%)
build/dom-ready/index.js 577 B +1 B (0%)
build/dom/index.js 4.62 kB -6 B (0%)
build/edit-navigation/index.js 13.6 kB -92 B (-1%)
build/edit-post/index.js 334 kB +1.06 kB (0%)
build/edit-post/style-rtl.css 6.84 kB +48 B (+1%)
build/edit-post/style.css 6.83 kB +49 B (+1%)
build/edit-site/index.js 26 kB -99 B (0%)
build/edit-widgets/index.js 12.5 kB -95 B (-1%)
build/editor/index.js 38.4 kB -22.1 kB (-36%) 🎉
build/element/index.js 3.44 kB -1 B (0%)
build/format-library/index.js 5.67 kB +6 B (0%)
build/i18n/index.js 3.73 kB -1 B (0%)
build/keycodes/index.js 1.43 kB -1 B (0%)
build/nux/index.js 2.31 kB +6 B (0%)
build/plugins/index.js 1.99 kB -13 B (-1%)
build/react-i18n/index.js 923 B -1 B (0%)
build/redux-routine/index.js 2.82 kB -3 B (0%)
build/reusable-blocks/index.js 2.54 kB -25 B (-1%)
build/rich-text/index.js 10.7 kB -13 B (0%)
build/server-side-render/index.js 1.64 kB -1 B (0%)
build/shortcode/index.js 1.68 kB -1 B (0%)
build/token-list/index.js 847 B -1 B (0%)
build/url/index.js 1.95 kB -1 B (0%)
build/widgets/index.js 1.66 kB -19 B (-1%)
ℹ️ View Unchanged
Filename Size Change
build/autop/index.js 2.28 kB 0 B
build/block-directory/style-rtl.css 993 B 0 B
build/block-directory/style.css 995 B 0 B
build/block-editor/style-rtl.css 13 kB 0 B
build/block-editor/style.css 13 kB 0 B
build/block-library/blocks/archives/editor-rtl.css 61 B 0 B
build/block-library/blocks/archives/editor.css 60 B 0 B
build/block-library/blocks/audio/editor-rtl.css 58 B 0 B
build/block-library/blocks/audio/editor.css 58 B 0 B
build/block-library/blocks/audio/style-rtl.css 112 B 0 B
build/block-library/blocks/audio/style.css 112 B 0 B
build/block-library/blocks/block/editor-rtl.css 161 B 0 B
build/block-library/blocks/block/editor.css 161 B 0 B
build/block-library/blocks/button/editor-rtl.css 475 B 0 B
build/block-library/blocks/button/editor.css 474 B 0 B
build/block-library/blocks/button/style-rtl.css 601 B 0 B
build/block-library/blocks/button/style.css 600 B 0 B
build/block-library/blocks/buttons/editor-rtl.css 315 B 0 B
build/block-library/blocks/buttons/editor.css 315 B 0 B
build/block-library/blocks/buttons/style-rtl.css 375 B 0 B
build/block-library/blocks/buttons/style.css 375 B 0 B
build/block-library/blocks/calendar/style-rtl.css 208 B 0 B
build/block-library/blocks/calendar/style.css 208 B 0 B
build/block-library/blocks/categories/editor-rtl.css 84 B 0 B
build/block-library/blocks/categories/editor.css 83 B 0 B
build/block-library/blocks/categories/style-rtl.css 79 B 0 B
build/block-library/blocks/categories/style.css 79 B 0 B
build/block-library/blocks/code/style-rtl.css 90 B 0 B
build/block-library/blocks/code/style.css 90 B 0 B
build/block-library/blocks/columns/editor-rtl.css 190 B 0 B
build/block-library/blocks/columns/editor.css 190 B 0 B
build/block-library/blocks/columns/style-rtl.css 422 B 0 B
build/block-library/blocks/columns/style.css 422 B 0 B
build/block-library/blocks/cover/editor-rtl.css 643 B 0 B
build/block-library/blocks/cover/editor.css 645 B 0 B
build/block-library/blocks/cover/style-rtl.css 1.22 kB 0 B
build/block-library/blocks/cover/style.css 1.22 kB 0 B
build/block-library/blocks/embed/editor-rtl.css 486 B 0 B
build/block-library/blocks/embed/editor.css 486 B 0 B
build/block-library/blocks/embed/style-rtl.css 401 B 0 B
build/block-library/blocks/embed/style.css 400 B 0 B
build/block-library/blocks/file/editor-rtl.css 301 B 0 B
build/block-library/blocks/file/editor.css 300 B 0 B
build/block-library/blocks/file/frontend.js 772 B 0 B
build/block-library/blocks/file/style-rtl.css 255 B 0 B
build/block-library/blocks/file/style.css 255 B 0 B
build/block-library/blocks/freeform/editor-rtl.css 2.45 kB 0 B
build/block-library/blocks/freeform/editor.css 2.45 kB 0 B
build/block-library/blocks/gallery/editor-rtl.css 704 B 0 B
build/block-library/blocks/gallery/editor.css 705 B 0 B
build/block-library/blocks/gallery/style-rtl.css 1.06 kB 0 B
build/block-library/blocks/gallery/style.css 1.05 kB 0 B
build/block-library/blocks/group/editor-rtl.css 160 B 0 B
build/block-library/blocks/group/editor.css 160 B 0 B
build/block-library/blocks/group/style-rtl.css 57 B 0 B
build/block-library/blocks/group/style.css 57 B 0 B
build/block-library/blocks/heading/editor-rtl.css 129 B 0 B
build/block-library/blocks/heading/editor.css 129 B 0 B
build/block-library/blocks/heading/style-rtl.css 76 B 0 B
build/block-library/blocks/heading/style.css 76 B 0 B
build/block-library/blocks/home-link/style-rtl.css 259 B 0 B
build/block-library/blocks/home-link/style.css 259 B 0 B
build/block-library/blocks/html/editor-rtl.css 281 B 0 B
build/block-library/blocks/html/editor.css 281 B 0 B
build/block-library/blocks/image/editor-rtl.css 717 B 0 B
build/block-library/blocks/image/editor.css 716 B 0 B
build/block-library/blocks/image/style-rtl.css 481 B 0 B
build/block-library/blocks/image/style.css 485 B 0 B
build/block-library/blocks/latest-comments/style-rtl.css 281 B 0 B
build/block-library/blocks/latest-comments/style.css 282 B 0 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B 0 B
build/block-library/blocks/latest-posts/editor.css 137 B 0 B
build/block-library/blocks/latest-posts/style-rtl.css 523 B 0 B
build/block-library/blocks/latest-posts/style.css 522 B 0 B
build/block-library/blocks/legacy-widget/editor-rtl.css 557 B 0 B
build/block-library/blocks/legacy-widget/editor.css 557 B 0 B
build/block-library/blocks/list/style-rtl.css 63 B 0 B
build/block-library/blocks/list/style.css 63 B 0 B
build/block-library/blocks/media-text/editor-rtl.css 176 B 0 B
build/block-library/blocks/media-text/editor.css 176 B 0 B
build/block-library/blocks/media-text/style-rtl.css 492 B 0 B
build/block-library/blocks/media-text/style.css 489 B 0 B
build/block-library/blocks/more/editor-rtl.css 434 B 0 B
build/block-library/blocks/more/editor.css 434 B 0 B
build/block-library/blocks/navigation-link/editor-rtl.css 617 B 0 B
build/block-library/blocks/navigation-link/editor.css 619 B 0 B
build/block-library/blocks/navigation-link/style-rtl.css 94 B 0 B
build/block-library/blocks/navigation-link/style.css 94 B 0 B
build/block-library/blocks/nextpage/editor-rtl.css 395 B 0 B
build/block-library/blocks/nextpage/editor.css 395 B 0 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B 0 B
build/block-library/blocks/paragraph/editor.css 157 B 0 B
build/block-library/blocks/paragraph/style-rtl.css 247 B 0 B
build/block-library/blocks/paragraph/style.css 248 B 0 B
build/block-library/blocks/post-author/editor-rtl.css 209 B 0 B
build/block-library/blocks/post-author/editor.css 209 B 0 B
build/block-library/blocks/post-author/style-rtl.css 183 B 0 B
build/block-library/blocks/post-author/style.css 184 B 0 B
build/block-library/blocks/post-comments-form/style-rtl.css 140 B 0 B
build/block-library/blocks/post-comments-form/style.css 140 B 0 B
build/block-library/blocks/post-comments/style-rtl.css 360 B 0 B
build/block-library/blocks/post-comments/style.css 359 B 0 B
build/block-library/blocks/post-content/editor-rtl.css 139 B 0 B
build/block-library/blocks/post-content/editor.css 139 B 0 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B 0 B
build/block-library/blocks/post-excerpt/editor.css 73 B 0 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B 0 B
build/block-library/blocks/post-excerpt/style.css 69 B 0 B
build/block-library/blocks/post-featured-image/editor-rtl.css 338 B 0 B
build/block-library/blocks/post-featured-image/editor.css 338 B 0 B
build/block-library/blocks/post-featured-image/style-rtl.css 119 B 0 B
build/block-library/blocks/post-featured-image/style.css 119 B 0 B
build/block-library/blocks/post-title/style-rtl.css 60 B 0 B
build/block-library/blocks/post-title/style.css 60 B 0 B
build/block-library/blocks/preformatted/style-rtl.css 103 B 0 B
build/block-library/blocks/preformatted/style.css 103 B 0 B
build/block-library/blocks/pullquote/editor-rtl.css 183 B 0 B
build/block-library/blocks/pullquote/editor.css 183 B 0 B
build/block-library/blocks/pullquote/style-rtl.css 318 B 0 B
build/block-library/blocks/pullquote/style.css 318 B 0 B
build/block-library/blocks/query-loop/editor-rtl.css 83 B 0 B
build/block-library/blocks/query-loop/editor.css 82 B 0 B
build/block-library/blocks/query-loop/style-rtl.css 315 B 0 B
build/block-library/blocks/query-loop/style.css 317 B 0 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B 0 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B 0 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B 0 B
build/block-library/blocks/query-pagination/editor.css 262 B 0 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B 0 B
build/block-library/blocks/query-pagination/style.css 168 B 0 B
build/block-library/blocks/query-title/editor-rtl.css 86 B 0 B
build/block-library/blocks/query-title/editor.css 86 B 0 B
build/block-library/blocks/query/editor-rtl.css 131 B 0 B
build/block-library/blocks/query/editor.css 132 B 0 B
build/block-library/blocks/quote/style-rtl.css 169 B 0 B
build/block-library/blocks/quote/style.css 169 B 0 B
build/block-library/blocks/rss/editor-rtl.css 201 B 0 B
build/block-library/blocks/rss/editor.css 202 B 0 B
build/block-library/blocks/rss/style-rtl.css 290 B 0 B
build/block-library/blocks/rss/style.css 290 B 0 B
build/block-library/blocks/search/editor-rtl.css 189 B 0 B
build/block-library/blocks/search/editor.css 189 B 0 B
build/block-library/blocks/search/style-rtl.css 359 B 0 B
build/block-library/blocks/search/style.css 362 B 0 B
build/block-library/blocks/separator/editor-rtl.css 99 B 0 B
build/block-library/blocks/separator/editor.css 99 B 0 B
build/block-library/blocks/separator/style-rtl.css 251 B 0 B
build/block-library/blocks/separator/style.css 251 B 0 B
build/block-library/blocks/shortcode/editor-rtl.css 512 B 0 B
build/block-library/blocks/shortcode/editor.css 512 B 0 B
build/block-library/blocks/site-logo/editor-rtl.css 440 B 0 B
build/block-library/blocks/site-logo/editor.css 441 B 0 B
build/block-library/blocks/site-logo/style-rtl.css 154 B 0 B
build/block-library/blocks/site-logo/style.css 154 B 0 B
build/block-library/blocks/social-link/editor-rtl.css 164 B 0 B
build/block-library/blocks/social-link/editor.css 165 B 0 B
build/block-library/blocks/social-links/editor-rtl.css 796 B 0 B
build/block-library/blocks/social-links/editor.css 795 B 0 B
build/block-library/blocks/social-links/style-rtl.css 1.32 kB 0 B
build/block-library/blocks/social-links/style.css 1.33 kB 0 B
build/block-library/blocks/spacer/editor-rtl.css 308 B 0 B
build/block-library/blocks/spacer/editor.css 308 B 0 B
build/block-library/blocks/spacer/style-rtl.css 48 B 0 B
build/block-library/blocks/spacer/style.css 48 B 0 B
build/block-library/blocks/table/editor-rtl.css 478 B 0 B
build/block-library/blocks/table/editor.css 478 B 0 B
build/block-library/blocks/table/style-rtl.css 485 B 0 B
build/block-library/blocks/table/style.css 485 B 0 B
build/block-library/blocks/tag-cloud/editor-rtl.css 118 B 0 B
build/block-library/blocks/tag-cloud/editor.css 118 B 0 B
build/block-library/blocks/tag-cloud/style-rtl.css 94 B 0 B
build/block-library/blocks/tag-cloud/style.css 94 B 0 B
build/block-library/blocks/template-part/editor-rtl.css 551 B 0 B
build/block-library/blocks/template-part/editor.css 550 B 0 B
build/block-library/blocks/term-description/editor-rtl.css 90 B 0 B
build/block-library/blocks/term-description/editor.css 90 B 0 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B 0 B
build/block-library/blocks/text-columns/editor.css 95 B 0 B
build/block-library/blocks/text-columns/style-rtl.css 166 B 0 B
build/block-library/blocks/text-columns/style.css 166 B 0 B
build/block-library/blocks/verse/style-rtl.css 87 B 0 B
build/block-library/blocks/verse/style.css 87 B 0 B
build/block-library/blocks/video/editor-rtl.css 569 B 0 B
build/block-library/blocks/video/editor.css 570 B 0 B
build/block-library/blocks/video/style-rtl.css 169 B 0 B
build/block-library/blocks/video/style.css 169 B 0 B
build/block-library/common-rtl.css 1.26 kB 0 B
build/block-library/common.css 1.26 kB 0 B
build/block-library/reset-rtl.css 506 B 0 B
build/block-library/reset.css 507 B 0 B
build/block-library/theme-rtl.css 692 B 0 B
build/block-library/theme.css 693 B 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/customize-widgets/style-rtl.css 698 B 0 B
build/customize-widgets/style.css 699 B 0 B
build/date/index.js 31.8 kB 0 B
build/edit-navigation/style-rtl.css 2.83 kB 0 B
build/edit-navigation/style.css 2.83 kB 0 B
build/edit-post/classic-rtl.css 454 B 0 B
build/edit-post/classic.css 454 B 0 B
build/edit-site/style-rtl.css 4.79 kB 0 B
build/edit-site/style.css 4.78 kB 0 B
build/edit-widgets/style-rtl.css 3.02 kB 0 B
build/edit-widgets/style.css 3.03 kB 0 B
build/editor/style-rtl.css 3.95 kB 0 B
build/editor/style.css 3.95 kB 0 B
build/escape-html/index.js 739 B 0 B
build/format-library/style-rtl.css 637 B 0 B
build/format-library/style.css 639 B 0 B
build/hooks/index.js 1.76 kB 0 B
build/html-entities/index.js 628 B 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 1.65 kB 0 B
build/list-reusable-blocks/index.js 2.06 kB 0 B
build/list-reusable-blocks/style-rtl.css 629 B 0 B
build/list-reusable-blocks/style.css 628 B 0 B
build/media-utils/index.js 3.08 kB 0 B
build/navigation/index.js 2.85 kB 0 B
build/notices/index.js 1.07 kB 0 B
build/nux/style-rtl.css 718 B 0 B
build/nux/style.css 716 B 0 B
build/primitives/index.js 1.03 kB 0 B
build/priority-queue/index.js 791 B 0 B
build/reusable-blocks/style-rtl.css 225 B 0 B
build/reusable-blocks/style.css 225 B 0 B
build/viewport/index.js 1.28 kB 0 B
build/warning/index.js 1.13 kB 0 B
build/wordcount/index.js 1.24 kB 0 B

compressed-size-action

@ellatrix ellatrix force-pushed the try/nav-block-remove-list branch from 76dfbe5 to 2531718 Compare May 14, 2021 11:49
@getdave
Copy link
Contributor

getdave commented May 14, 2021

I understand all your points. From an accessibility viewpoint though are we confident that removing the affordances provided by lists wont provide a poorer UX? For example I believe the total items in lists are announced where as that wouldnt work for more generic markup.

What if the user has a giant navigation? Without that affordance a user of assistive tech might dive into a series of items without any idea of how deep the rabbit hole goes.

Not saying your points arent valid but just checking weve considered all a11y considerations. My knowledge may be out of date but Id rather be safe than sorry.

@priethor priethor added the [Block] Navigation Affects the Navigation Block label May 14, 2021
@priethor
Copy link
Contributor

This PR would solve #29036 and open many possibilities. On the other hand, regarding navigation accessibility, as far as I know, it was discussed in #24364 (comment) determining links indeed need to be wrapped with a ul. It might be worth, though, discussing it again from this perspective.

@ellatrix
Copy link
Member Author

For example I believe the total items in lists are announced where as that wouldnt work for more generic markup.

We should be able to add a label for that.

Copy link
Contributor

@gwwar gwwar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ellatrix for making us rethink our existing assumptions! ✨ If I read the threads correctly, this assumption might sum up to we must use a ul for accessible navigation links.

On the technical side of things, I do prefer keeping things simple so this approach has a lot of appeal on that front. All types of blocks that we insert into navigation block (including spacer, social links, etc) will now validate as correct html5 markup which is also very good.

I briefly tested this in VoiceOver and one of the main differences is that UL will list how many links there are. We might be able to work around that by using a good combination of role="navigation" and a good generated aria-label to help make up for this.

If anyone has access to the JAWS screen reader I think it'd be good to help spot any other differences here.

The blocking factor for this change I think is whether or not the community here thinks this will work for screen readers. I'd be interested in finding folks who use screen readers daily to provide some feedback, but barring that we might need to bring this up for discussion with a wider group.

So TL;DR, this is very elegant and will 💯 work technically, but we should get feedback on if this is acceptable on the a11y side of things.

@@ -146,7 +146,7 @@ function render_block_core_navigation_link( $attributes, $content, $block ) {
'style' => $style_attribute,
)
);
$html = '<li ' . $wrapper_attributes . '>' .
$html = '<div ' . $wrapper_attributes . '>' .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following this line of thinking, I think it should be possible to drop this div wrapper too here in navigation-link and home-link.

This change would need to rework the css for how submenus work, of course.

This is non blocking since changes here work well and now markup validates properly, but I think it'd be worth exploring.

Example before Example after
Screen Shot 2021-05-14 at 10 10 14 AM Screen Shot 2021-05-14 at 10 24 46 AM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, but I didn't want to touch the styling as part of this PR. :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this could be done as a follow up too if we choose this approach 👍

@priethor priethor added the Needs Accessibility Feedback Need input from accessibility label May 14, 2021
@carolinan carolinan requested review from joedolson and alexstine May 17, 2021 07:10
@carolinan
Copy link
Contributor

carolinan commented May 17, 2021

In the editor, there is still an UL left:
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/navigation/edit.js#L176

Disclaimer: I am not a screen reader user, the only time I use a screen reader is for testing. I don't think the usability of the block falls on if a list element is used or not. I found both versions, trunk and this PR, very difficult to use.
With NVDA:
As with the columns block, the visible focus is lost when I try to move between the menu items.
The visible focus outline stays on the first item, even though the screen reader reads the text link of the second item, and so son.

Where I, as a beginner screen reader user try to move to the next item using tab, I leave the block and end up on the post settings sidebar. Using arrow keys: up and down -nothing happens. Left or right: the text of the current menu item is read out one letter at the time.

Even though all the information below is read out, I am still not able to tell that all menu items have sub menus except for the last item:

With list:
clickable Block: Navigation grouping list with 6 items Block: Custom Link grouping Navigation link text edit multi line Pages out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Categories out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Depth out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Advanced out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Menu Description out of edit out of grouping Add block

With div:
Block: Navigation grouping Block: Custom Link grouping Navigation link text edit multi line Pages out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Categories out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Depth out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Advanced out of edit out of grouping Block: Custom Link grouping clickable Navigation link text edit multi line Menu Description out of edit out of grouping Add block

@getdave
Copy link
Contributor

getdave commented May 17, 2021

clickable Block: Navigation grouping list with 6 items Block:

This is a key example. Imagine if the list had 100 items and it didn't announce the number of items? It would provide a terrible user experience.

We can use labels but 9 times out of 10 the most accessible route is to use plain old HTML.

I am of course open to the fact that this might be the 1 time HTML doesn't cut the mustard but IMHO we should definitely be bringing this decision up with the a11y teams before we proceed.

Update: I just read @gwwar's response in which she puts this far more elegantly. I agree with Kerry.

@draganescu
Copy link
Contributor

Howdy @ellatrix ! I believe @tellthemachines 's #30430 also tries to free the navigation block from the ul container. As far as we grasped from this conversation (Slack), we need though to allow menus to contain lists of links for various compatibility with assitive tech and to enable semantic link lists. It is not clear to me if rooles and labels are good enough.

So, while removing the default UL > LI markup for the block is good in my opinion, at the same time we need to enable a way to place in the block simple "link list" based navigation.

The problem we're facing is one of UX complexity. We don't know what the initial intent of the user is when a navigation block is used, and how the complexity of the block will evolve as the user adds content. The reason we have a list based markup is only because we did not start with the premise of the navigation as an open canvas, but more on the pattern of the classic WP menus, which are nested lists of links. For nested lists of links ULs are great.

Once one starts to imagine the navigation block as a canvas for any kind of menu (including marketing heavy mega menus) the problems of learning curve, initial action etc. immediately pop up. So this is where adding a passthrough block shines as an idea. We make a block like the one in #30430 and the user never knows it's there.

Neither of these solutions (this PR, #30430, a passthrough block, rendering markup on front end only) really solve the problem that by allowing various blocks in menus we're making it a mini editor which is basically a special case of the group block. I think the navigation block is now at a point where the problems it has are not so much about how to implement it but about what do we want it to achieve? I mean this example from @jasmussen does it really need to be handled by a single block?

@ellatrix
Copy link
Member Author

I'm actually starting to think that lists do fulfil a purpose here. While we could add labels etc., it does nicely group links together as a single entity next to spacers and search blocks, which you probably don't want to mix with links in the menu. For example, it's probably not great if a user could move a search block between links, they should rather only be able to move it before and after the ... list.

So with that thought, I'm closing my PR.

@ellatrix ellatrix closed this May 17, 2021
@ellatrix ellatrix deleted the try/nav-block-remove-list branch May 17, 2021 12:09
@carolinan carolinan removed the Needs Accessibility Feedback Need input from accessibility label May 17, 2021
@ellatrix
Copy link
Member Author

Ok, apparent it should be possible to move non-links into a list of links, such as search or the site title, so in that case I'm again for removing the list markup. I'll add a label for the item count shortly.

@ellatrix ellatrix restored the try/nav-block-remove-list branch May 17, 2021 19:19
@ellatrix ellatrix reopened this May 17, 2021
@alexstine alexstine added the Needs Accessibility Feedback Need input from accessibility label May 17, 2021
@alexstine
Copy link
Contributor

Just to confirm, I should be testing the Navigation block after you push the change to add count label?

Thanks.

@ellatrix
Copy link
Member Author

@alexstine Yes, I'll add a count label in a bit. I can ping you once I've added it. 🙂

@joedolson
Copy link
Contributor

Will there still be a way to define subgroups within the navigation if lists are not used? That's traditionally been done via nested lists, but I'm not clear how this is going to happen without lists.

Any flow content is permitted within a <nav> element; it doesn't have to be restricted to just a list, so it's feasible to do other things. But the average navigation is still probably best represented by a list of links.

I'm having a little trouble imagining exactly what the end result for this block will be for either the editor or the user, though, so it's hard to comment until after testing. Even then, it sounds like it'll take some serious testing.

@tellthemachines
Copy link
Contributor

Ok, apparent it should be possible to move non-links into a list of links, such as search or the site title

I'm not clear on this point, could you link to sources/discussion? A big part of the a11y concern was isolating links from non-links, so I wouldn't expect it to be possible to move a non-link inside a list of links.

@jasmussen
Copy link
Contributor

I'm not clear on this point, could you link to sources/discussion?

Andrei summed it up nicely.

Semantic accessible markup is a given. We also need to retain the current user experience — additional containers surfaced to the user are not going to be intuitive.

@jasmussen
Copy link
Contributor

Should we close this one now the markup change has been addressed elsewhere?

@ellatrix
Copy link
Member Author

ellatrix commented Jul 8, 2021

Sure :)

@ellatrix ellatrix closed this Jul 8, 2021
@ellatrix ellatrix deleted the try/nav-block-remove-list branch July 8, 2021 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block Needs Accessibility Feedback Need input from accessibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants