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

Components: replace TabPanel with Tabs in the editor Document Overview sidebar #57082

Merged
merged 13 commits into from
Jan 30, 2024

Conversation

chad1008
Copy link
Contributor

@chad1008 chad1008 commented Dec 14, 2023

What?

Replaces the legacy TabPanel component with the new Tabs component.

Why?

Part of the work outlined in #52997

How?

TabPanel is replaced by Tabs and its sub-components.

The biggest change in terms of actual behavior is the order of the tab stops. Previously, the close button had to be rendered outside of (specifically before) TabPanel and then placed next to the tabs via CSS. With Tabs we can actually compose the sidebar with the button right where we want it. This changes the flow of focus when tabbing into the sidebar:

Before After
  1. Close Button
  2. Active Tab
  3. The currently displayed `tabpanel`
  4. First focusable element within the current `tabpanel`
  1. Active Tab
  2. Close Button
  3. The currently displayed `tabpanel`
  4. First focusable element within the current `tabpanel`

This matches what the Editor Settings sidebar on the other side of the screen does, but I wanted to confirm this is an acceptable change from an a11y point of view, for both sidebars. cc @andrewhayward @alexstine

Notes

  1. There are some visual changes at the moment regarding hover effects and text alignment on the tabs. These are being discuss/addressed in Tabs: render tabs as Button components by default #57121
  2. There is currently one failing e2e test, which is a direct result of the change in tabstops mentioned above. Before this merges, I'll make sure we update either the test or the tab flow as necessary.

Testing Instructions

  1. Create a new post and open the Document Overview sidebar
  2. Test the Document Overview and Outline tabs, confirming they work as expected and display the correct data
  3. Open and close the sidebar to confirm there are no errors.
  4. Test the shortcut keys (alt+shift+o on Windows, and control+option+o on Mac) to confirm it opens and closes the sidebar properly

This sidebar has some specific focus behavior built-in. The following tests are to double check we aren't breaking any of that.
tl;dr:

  • When closed, the shortcut key should open the sidebar.
  • When open, if the sidebar doesn't have focus the shortcut should apply focus to the correct element in the sidebar.
  • When open, if the sidebar does have focus, the shortcut should close the sidebar
  • When the shortcut closes the sidebar, focus should land on the Document Overview sidebar toggle button

On a post with no blocks:

  1. Click to place focus on the canvas
  2. Press the Document Overview shortcut keys
  3. Document Overview should open, focus should remain on the editor canvas
  4. Press the shortcut again, focus should move to the first tabbable item in the sidebar (ie, the List View tab)
  5. Press the shortcut one more time, and the sidebar should close
  6. Confirm that when the sidebar closes, the focus goes to the sidebar toggle button
  7. Open the Document Overview again (either by clicking or by shortcut, it doesn't matter which)
  8. Click any element in the sidebar to focus it
  9. Press the shortcut keys, and the sidebar should close
  10. Open the sidebar, and then click the canvas to move focus outside the sidebar
  11. Press the shortcut keys, and confirm focus moves to the first tabbale item (which should still be the List View tab)
  12. Press the shortcut keys again, the sidebar should close

On a post with blocks:

  1. Click to place focus on the canvas
  2. Press the Document Overview shortcut keys
  3. Document Overview should open, focus should go straight to the first block listed in the sidebar
  4. Pressing the shortcut keys again should close the sidebar
  5. Confirm that when the sidebar closes, the focus goes to the sidebar toggle button
  6. Open the sidebar, and then click the canvas to move focus outside the sidebar
  7. Press the shortcut keys, and confirm focus moves to the first block in the list
  8. Press the shortcut keys again, the sidebar should close

Testing Instructions for Keyboard

  1. Create a new post
  2. Press ctrl+` four times to navigate to the top toolbar region
  3. Press [Tab] to focus the first toolbar button
  4. [ArrowRight] to the Document Overview button
  5. Press [Enter/Return/Space] to action the button and open the sidebar
  6. Press [Tab] until you've traversed the top toolbar
  7. When focus lands on the List View tab, confirm that arrow keys can be used to navigate between tabs
  8. Select a tab with [Enter/Return/Space]
  9. Confirm that [Tab] moves focus to the Close button
  10. Confirm that [Tab] again moves focus to the canvas, because there's nothing in the list view/outline
  11. Close the sidebar by pressing the shortcut key twice
  12. Add some text to the default paragraph block
  13. Use ctrl+` to once again navigate to the top toolbar
  14. [Tab] will now focus the Document Overview toggle
  15. Open the sidebar, confirm that focus jumps to the first block in the list

Copy link

github-actions bot commented Dec 14, 2023

Size Change: +166 B (0%)

Total Size: 1.7 MB

Filename Size Change
build/block-editor/index.min.js 250 kB +77 B (0%)
build/block-library/index.min.js 215 kB -4 B (0%)
build/edit-site/index.min.js 195 kB +12 B (0%)
build/edit-widgets/index.min.js 17.3 kB -4 B (0%)
build/editor/index.min.js 61.7 kB +57 B (0%)
build/editor/style-rtl.css 5.43 kB +13 B (0%)
build/editor/style.css 5.43 kB +15 B (0%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 955 B
build/annotations/index.min.js 2.69 kB
build/api-fetch/index.min.js 2.32 kB
build/autop/index.min.js 2.1 kB
build/blob/index.min.js 578 B
build/block-directory/index.min.js 7.22 kB
build/block-directory/style-rtl.css 1.02 kB
build/block-directory/style.css 1.02 kB
build/block-editor/content-rtl.css 4.38 kB
build/block-editor/content.css 4.38 kB
build/block-editor/default-editor-styles-rtl.css 381 B
build/block-editor/default-editor-styles.css 381 B
build/block-editor/style-rtl.css 15.5 kB
build/block-editor/style.css 15.5 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 90 B
build/block-library/blocks/archives/style.css 90 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 126 B
build/block-library/blocks/audio/theme.css 126 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 415 B
build/block-library/blocks/button/editor.css 414 B
build/block-library/blocks/button/style-rtl.css 627 B
build/block-library/blocks/button/style.css 626 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/columns/style-rtl.css 421 B
build/block-library/blocks/columns/style.css 421 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 199 B
build/block-library/blocks/comment-template/style.css 198 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.69 kB
build/block-library/blocks/cover/style.css 1.68 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 98 B
build/block-library/blocks/details/style.css 98 B
build/block-library/blocks/embed/editor-rtl.css 322 B
build/block-library/blocks/embed/editor.css 322 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 126 B
build/block-library/blocks/embed/theme.css 126 B
build/block-library/blocks/file/editor-rtl.css 316 B
build/block-library/blocks/file/editor.css 316 B
build/block-library/blocks/file/style-rtl.css 280 B
build/block-library/blocks/file/style.css 281 B
build/block-library/blocks/file/view.min.js 316 B
build/block-library/blocks/footnotes/style-rtl.css 201 B
build/block-library/blocks/footnotes/style.css 199 B
build/block-library/blocks/form-input/editor-rtl.css 227 B
build/block-library/blocks/form-input/editor.css 227 B
build/block-library/blocks/form-input/style-rtl.css 343 B
build/block-library/blocks/form-input/style.css 343 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 340 B
build/block-library/blocks/form-submission-notification/editor.css 340 B
build/block-library/blocks/form-submit-button/style-rtl.css 69 B
build/block-library/blocks/form-submit-button/style.css 69 B
build/block-library/blocks/form/view.min.js 452 B
build/block-library/blocks/freeform/editor-rtl.css 2.61 kB
build/block-library/blocks/freeform/editor.css 2.61 kB
build/block-library/blocks/gallery/editor-rtl.css 947 B
build/block-library/blocks/gallery/editor.css 952 B
build/block-library/blocks/gallery/style-rtl.css 1.72 kB
build/block-library/blocks/gallery/style.css 1.72 kB
build/block-library/blocks/gallery/theme-rtl.css 108 B
build/block-library/blocks/gallery/theme.css 108 B
build/block-library/blocks/group/editor-rtl.css 654 B
build/block-library/blocks/group/editor.css 654 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 189 B
build/block-library/blocks/heading/style.css 189 B
build/block-library/blocks/html/editor-rtl.css 336 B
build/block-library/blocks/html/editor.css 337 B
build/block-library/blocks/image/editor-rtl.css 863 B
build/block-library/blocks/image/editor.css 862 B
build/block-library/blocks/image/style-rtl.css 1.6 kB
build/block-library/blocks/image/style.css 1.59 kB
build/block-library/blocks/image/theme-rtl.css 126 B
build/block-library/blocks/image/theme.css 126 B
build/block-library/blocks/image/view.min.js 2.01 kB
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 505 B
build/block-library/blocks/media-text/style.css 503 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 668 B
build/block-library/blocks/navigation-link/editor.css 669 B
build/block-library/blocks/navigation-link/style-rtl.css 103 B
build/block-library/blocks/navigation-link/style.css 103 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 296 B
build/block-library/blocks/navigation-submenu/editor.css 295 B
build/block-library/blocks/navigation/editor-rtl.css 2.25 kB
build/block-library/blocks/navigation/editor.css 2.26 kB
build/block-library/blocks/navigation/style-rtl.css 2.24 kB
build/block-library/blocks/navigation/style.css 2.23 kB
build/block-library/blocks/navigation/view.min.js 1.1 kB
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 377 B
build/block-library/blocks/page-list/editor.css 377 B
build/block-library/blocks/page-list/style-rtl.css 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 235 B
build/block-library/blocks/paragraph/editor.css 235 B
build/block-library/blocks/paragraph/style-rtl.css 335 B
build/block-library/blocks/paragraph/style.css 335 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/editor-rtl.css 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 508 B
build/block-library/blocks/post-comments-form/style.css 508 B
build/block-library/blocks/post-content/editor-rtl.css 74 B
build/block-library/blocks/post-content/editor.css 74 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 666 B
build/block-library/blocks/post-featured-image/editor.css 662 B
build/block-library/blocks/post-featured-image/style-rtl.css 342 B
build/block-library/blocks/post-featured-image/style.css 342 B
build/block-library/blocks/post-navigation-link/style-rtl.css 215 B
build/block-library/blocks/post-navigation-link/style.css 214 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 409 B
build/block-library/blocks/post-template/style.css 408 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 125 B
build/block-library/blocks/preformatted/style.css 125 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 354 B
build/block-library/blocks/pullquote/style.css 354 B
build/block-library/blocks/pullquote/theme-rtl.css 168 B
build/block-library/blocks/pullquote/theme.css 168 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 486 B
build/block-library/blocks/query/editor.css 486 B
build/block-library/blocks/query/style-rtl.css 312 B
build/block-library/blocks/query/style.css 308 B
build/block-library/blocks/query/view.min.js 1.1 kB
build/block-library/blocks/quote/style-rtl.css 237 B
build/block-library/blocks/quote/style.css 237 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/read-more/style-rtl.css 140 B
build/block-library/blocks/read-more/style.css 140 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 184 B
build/block-library/blocks/search/editor.css 184 B
build/block-library/blocks/search/style-rtl.css 614 B
build/block-library/blocks/search/style.css 614 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/search/view.min.js 471 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 229 B
build/block-library/blocks/separator/style.css 229 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 323 B
build/block-library/blocks/shortcode/editor.css 323 B
build/block-library/blocks/site-logo/editor-rtl.css 754 B
build/block-library/blocks/site-logo/editor.css 754 B
build/block-library/blocks/site-logo/style-rtl.css 204 B
build/block-library/blocks/site-logo/style.css 204 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 682 B
build/block-library/blocks/social-links/editor.css 681 B
build/block-library/blocks/social-links/style-rtl.css 1.49 kB
build/block-library/blocks/social-links/style.css 1.49 kB
build/block-library/blocks/spacer/editor-rtl.css 348 B
build/block-library/blocks/spacer/editor.css 348 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 395 B
build/block-library/blocks/table/editor.css 395 B
build/block-library/blocks/table/style-rtl.css 639 B
build/block-library/blocks/table/style.css 639 B
build/block-library/blocks/table/theme-rtl.css 146 B
build/block-library/blocks/table/theme.css 146 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 403 B
build/block-library/blocks/template-part/editor.css 403 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/term-description/style-rtl.css 111 B
build/block-library/blocks/term-description/style.css 111 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 185 B
build/block-library/blocks/video/style.css 185 B
build/block-library/blocks/video/theme-rtl.css 126 B
build/block-library/blocks/video/theme.css 126 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.1 kB
build/block-library/common.css 1.1 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 12.3 kB
build/block-library/editor.css 12.3 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/style-rtl.css 14.7 kB
build/block-library/style.css 14.7 kB
build/block-library/theme-rtl.css 688 B
build/block-library/theme.css 693 B
build/block-serialization-default-parser/index.min.js 1.12 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/blocks/index.min.js 51.5 kB
build/commands/index.min.js 15.5 kB
build/commands/style-rtl.css 921 B
build/commands/style.css 918 B
build/components/index.min.js 235 kB
build/components/style-rtl.css 12 kB
build/components/style.css 12 kB
build/compose/index.min.js 12.6 kB
build/core-commands/index.min.js 2.71 kB
build/core-data/index.min.js 72.7 kB
build/customize-widgets/index.min.js 12.1 kB
build/customize-widgets/style-rtl.css 1.34 kB
build/customize-widgets/style.css 1.33 kB
build/data-controls/index.min.js 640 B
build/data/index.min.js 8.92 kB
build/date/index.min.js 17.8 kB
build/deprecated/index.min.js 451 B
build/dom-ready/index.min.js 324 B
build/dom/index.min.js 4.65 kB
build/edit-post/classic-rtl.css 544 B
build/edit-post/classic.css 545 B
build/edit-post/index.min.js 25 kB
build/edit-post/style-rtl.css 5.67 kB
build/edit-post/style.css 5.66 kB
build/edit-site/style-rtl.css 15.3 kB
build/edit-site/style.css 15.3 kB
build/edit-widgets/style-rtl.css 4.48 kB
build/edit-widgets/style.css 4.48 kB
build/element/index.min.js 4.83 kB
build/escape-html/index.min.js 537 B
build/format-library/index.min.js 7.85 kB
build/format-library/style-rtl.css 478 B
build/format-library/style.css 477 B
build/hooks/index.min.js 1.55 kB
build/html-entities/index.min.js 448 B
build/i18n/index.min.js 3.58 kB
build/interactivity/file.min.js 440 B
build/interactivity/image.min.js 2.15 kB
build/interactivity/index.min.js 12.8 kB
build/interactivity/navigation.min.js 1.23 kB
build/interactivity/query.min.js 884 B
build/interactivity/router.min.js 971 B
build/interactivity/search.min.js 610 B
build/is-shallow-equal/index.min.js 527 B
build/keyboard-shortcuts/index.min.js 1.74 kB
build/keycodes/index.min.js 1.46 kB
build/list-reusable-blocks/index.min.js 2.11 kB
build/list-reusable-blocks/style-rtl.css 836 B
build/list-reusable-blocks/style.css 836 B
build/media-utils/index.min.js 2.9 kB
build/modules/importmap-polyfill.min.js 12.2 kB
build/notices/index.min.js 948 B
build/nux/index.min.js 2 kB
build/nux/style-rtl.css 735 B
build/nux/style.css 732 B
build/patterns/index.min.js 5.46 kB
build/patterns/style-rtl.css 540 B
build/patterns/style.css 539 B
build/plugins/index.min.js 1.8 kB
build/preferences-persistence/index.min.js 2.07 kB
build/preferences/index.min.js 2.81 kB
build/preferences/style-rtl.css 698 B
build/preferences/style.css 700 B
build/primitives/index.min.js 975 B
build/priority-queue/index.min.js 1.52 kB
build/private-apis/index.min.js 1 kB
build/react-i18n/index.min.js 623 B
build/react-refresh-entry/index.min.js 9.47 kB
build/react-refresh-runtime/index.min.js 6.78 kB
build/redux-routine/index.min.js 2.7 kB
build/reusable-blocks/index.min.js 2.72 kB
build/reusable-blocks/style-rtl.css 243 B
build/reusable-blocks/style.css 243 B
build/rich-text/index.min.js 10.4 kB
build/router/index.min.js 1.79 kB
build/server-side-render/index.min.js 1.95 kB
build/shortcode/index.min.js 1.39 kB
build/style-engine/index.min.js 2.07 kB
build/token-list/index.min.js 582 B
build/url/index.min.js 3.72 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.8 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 957 B
build/warning/index.min.js 249 B
build/widgets/index.min.js 7.21 kB
build/widgets/style-rtl.css 1.15 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.02 kB

compressed-size-action

Copy link

github-actions bot commented Dec 14, 2023

Flaky tests detected in 80e6708.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7215568344
📝 Reported issues:

@chad1008 chad1008 force-pushed the tabs-list-view-sidebar branch from bb4ab07 to 80e6708 Compare December 14, 2023 22:59
@chad1008 chad1008 requested a review from a team December 15, 2023 18:31
@chad1008 chad1008 self-assigned this Dec 15, 2023
@chad1008 chad1008 added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Dec 15, 2023
@chad1008 chad1008 changed the title WIP: Components: replace TabPanel with Tabs in the editor List View Components: replace TabPanel with Tabs in the editor Document Overview sidebar Dec 15, 2023
@chad1008 chad1008 marked this pull request as ready for review December 15, 2023 18:33
@andrewhayward
Copy link
Contributor

andrewhayward commented Dec 19, 2023

Thanks for working on this @chad1008, and for the thorough testing instructions!

Document Overview should open, focus should remain on the editor canvas

Some of the interaction flow feels a bit weird to me (for example, not moving focus), but I'll leave that alone, as it's not introduced here.

Focus order

The biggest change in terms of actual behavior is the order of the tab stops [...] This matches what the Editor Settings sidebar on the other side of the screen does, but I wanted to confirm this is an acceptable change from an a11y point of view, for both sidebars.

For me, the 'before' behaviour, where the close button is before the tab control in the focus order, is more correct than the 'after' behaviour, and we'd ideally change the Editor Settings sidebar behaviour to match.

I'm not aware of any specific guidance regarding this particular scenario, where other controls are at play, but in general, I would expect the tab panel to immediately follow the tabs in the focus order, if at all possible...

When keyboard focus is on a tablist, or a tab within the tablist, the Tab key should be programmed to move from the focused tab — which may or may not be the selected tab — to the tabpanel which represents the currently selected tab.
(MDN: Tabpanel role)

When focus moves into the tab list, Tab places focus on the active tab element. When the tab list contains the focus, Tab moves focus to the next element in the page tab sequence outside the tablist, which is the tabpanel unless the first element containing meaningful content inside the tabpanel is focusable.
(W3: Tabs pattern keyboard interaction)

Tab selection

I also wanted to briefly mention tab selection.

Select a tab with [Enter/Return/Space]

Is there a reason why selection doesn't follow focus here?

It is recommended that tabs activate automatically when they receive focus as long as their associated tab panels are displayed without noticeable latency.
(W3: Tabs pattern keyboard interaction)

I don't want to assume we haven't had the conversation, but it doesn't feel like there's a good reason not to. Not a blocker by any means.

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Code changes look good. I always followed the testing instructions and couldn't spot any regressions 🚀

I'd be more comfortable if @andrewserong also took a look before approving, given his extensive work on the list view in the past months.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

I'd be more comfortable if @andrewserong also took a look before approving

Thanks for the ping, and for the work here!

There are some visual changes at the moment regarding hover effects and text alignment on the tabs. These are being discuss/addressed in #57121

I see this is now centering the labels for the buttons. I think these should be left aligned as on trunk unless this is an intentional design decision? To my eyes it looks a bit unbalanced having them be centered as other panels (like the block or template inspector controls) are left aligned.

Trunk This PR
image image

While it's fairly subtle, because the list view is a prominent part of the UI, I think it'd be good to settle on the desired design here before landing the PR.

In terms of usability, the keyboard behaviour is mostly working for me. The main issue I ran into is if you press the Right arrow key to go to Outline and then the Left arrow key to go back to the list view, then the focus behaviour appears to move the focus to the first selected list view item. Is that intentional? It feels like a bug to me, as I believe that focusing behaviour is only intended to run when the list view is initially opened. If it is intentional, it might be worth checking with @alexstine here, too, as I could imagine it being confusing when moving between panels.

2023-12-21.10.31.16.mp4

I'll be AFK after tomorrow, so apologies if I don't get back to this PR quickly! If it's still open in the new year, I'm happy to give it a re-review then 🙂

@ciampo
Copy link
Contributor

ciampo commented Dec 21, 2023

I see this is now centering the labels for the buttons.

Good point! #57275 has just been merged, and it contains the style tweaks to change the tabs text alignment :)

The main issue I ran into is if you press the Right arrow key to go to Outline and then the Left arrow key to go back to the list view, then the focus behaviour appears to move the focus to the first selected list view item. Is that intentional? It feels like a bug to me,

That also feels like a bug, we should look more into it.

I'll be AFK after tomorrow, so apologies if I don't get back to this PR quickly!

@chad1008 is also going to be AFK.

Let's resume work on this after the holidays

@andrewserong
Copy link
Contributor

Let's resume work on this after the holidays

Sounds good. Happy to help with re-reviews then!

@chad1008 chad1008 force-pushed the tabs-list-view-sidebar branch from 365d2e1 to 0d2c78e Compare January 2, 2024 20:48
@chad1008
Copy link
Contributor Author

chad1008 commented Jan 2, 2024

And we're back! Thanks for jumping in on this one @andrewserong, very good catch.

The reason this is happening is because I enabled focusOnMove. The previous TabPanel implementation intentionally had this disabled to account for this sidebar's specific focus behavior... when putting the PR together I thought the new focus handling introduced by Tabs made this unnecessary, but you've found an aspect to it that I missed.

Turning focusOnMove off again restores keyboard nav behavior currently present on trunk

  1. open sidebar
  2. select block
  3. click on the List View tab
  4. arrow key back and forth to your heart's content
  5. when you actually select the List View tab via [Return/Enter/Space] focus will then transition to the currently selected block, as it's supposed to whenever List View activates.

Sorry for overlooking that, and thank you again for spotting it.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @chad1008! That's resolved the keyboard behaviour for me 👍

In re-testing, unfortunately I think this PR appears to break the windowing logic for the list view, which controls the showing and hiding of list view items on very long posts. On trunk, if I scroll up and down the list view, items and shown and hidden. With this PR applied, the updates aren't occurring:

Trunk

2024-01-03.16.26.47.mp4

This PR

2024-01-03.16.27.11.mp4

For quickly testing very long posts, I'll either use a lorem ipsum generator or copy & paste an old book from the "other" Gutenberg 😄.

I'm not too sure what the cause is, but in case it helps digging into it, the list view calls useFixedWindowList here, and useFixedWindowList is defined here.

I wonder if something about the Tabs.TabPanel could be interfering with the useFixedWindowList's checking for a scroll container? I notice with this PR applied that the line that calls getScrollContainer returns the overall html document instead of the list view container, which is unexpected:

image

Another potential thing to look into if it isn't Tabs.TabPanel — could any of the CSS changes in this PR affect the getScrollContainer behaviour?

One other thing to keep in mind with changes to this component is that @youknowriad has opened a PR (#57467) to propose moving the component to live within the editor package so that it can be shared between both the post and site editors. So, whichever PR lands first, the other one will likely need some rebasing 🙂

Let me know how you go, happy to help with continued testing!

@andrewserong andrewserong added the [Feature] List View Menu item in the top toolbar to select blocks from a list of links. label Jan 3, 2024
@ciampo
Copy link
Contributor

ciampo commented Jan 3, 2024

has opened a PR (#57467) to propose moving the component to live within the editor package so that it can be shared between both the post and site editors. So, whichever PR lands first, the other one will likely need some rebasing 🙂

#57467 got merged, so this PR needs to be rebased. Let's also make sure we keep in mind the differences between post and site editor as highlighted in #57467 (comment)

@ciampo
Copy link
Contributor

ciampo commented Jan 3, 2024

I wonder if something about the Tabs.TabPanel could be interfering with the useFixedWindowList's checking for a scroll container?

@andrewserong , Chad and I debugged the issue and found out that the problem may be caused by Tabs not loading with a default selected tab id. This causes the Tabs component to have to figure out which tab to show when mounted, which in return causes a delay in rendering the list view. As a consequence, the scrollHeight and clientHeight properties in this check are initially computed with a value of 0, which makes the check fail, and causes the getScrollContainer function to continue traversing the DOM until it finds the HTML element. Subsequent re-renders would instead successfully pass the check, and therefore return the correct scroll container.

Luckily, there seems to be an easy fix — adding the initialTabId prop to Tabs should cause the component to render the selected tab immediately, ultimately allowing the getScrollContainer function to parse the height correctly.

I will let @chad1008 work on implementing the fix (together with rebasing after #57467 got merged), and then hopefully we'll be able to merge this PR 🤞

@andrewserong
Copy link
Contributor

Luckily, there seems to be an easy fix — adding the initialTabId prop to Tabs should cause the component to render the selected tab immediately, ultimately allowing the getScrollContainer function to parse the height correctly.

Nice debugging, folks! Let me know when this is ready for another review and I'll give it another spin 🙂

@chad1008 chad1008 force-pushed the tabs-list-view-sidebar branch from ed81b50 to 3eaaa01 Compare January 22, 2024 22:35
@chad1008
Copy link
Contributor Author

This PR slipped off my radar somehow, but I've made the change mentioned above that should prevent the poorly rendering scroll container for the list view. I've also rebased to incorporate the newest changes from trunk.

Would love a fresh opinion whenever you have a moment @andrewserong!

@chad1008 chad1008 requested a review from andrewserong January 24, 2024 02:07
@chad1008 chad1008 requested a review from ciampo January 24, 2024 02:07
Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Thanks for the ping, this is looking so close now @chad1008! The list view keyboard behaviour all appears to be working nicely for me now, and the issues we'd uncovered so far all appear to have been resolved (can switch between List View and Outline easily via keyboard, windowing logic is working).

While comparing between trunk and this PR, I noticed that it looks like some of the re-ordering means that the document outline has lost its padding. I've left a comment where I think there might be a classname missing for the document outline? This is the set of rules that don't appear to be applying with this PR active:

.editor-list-view-sidebar__list-view-container > .document-outline {

The result is that the document outline appears flush against the side of the viewport, instead of having a little breathing room (most notable when an h1 tag is in use):

Trunk

image

This PR

image

Perhaps a little clearer when navigating through the outline via keyboard, where the left edge of the outline gets cut off:

Trunk This PR
image image

Thanks again for all the detailed work on this one, I know it's a nuanced one!

@chad1008
Copy link
Contributor Author

Thanks you as always @andrewserong, both points on your feedback were good catches!

There is still a small visual shift in the placement of the second tab, which comes from the spacing for the close button no longer being an implicitly declared margin. I don't think it looks problematic but happy to tweak it if need be.

I did also add one small change replacing role based selectors with actual class names, based on some feedback on a different implementation of this component. It shouldn't have any impact on the look of the sidebar.

@chad1008 chad1008 requested a review from andrewserong January 26, 2024 19:16
Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @chad1008, the document outline is looking good now!

There is still a small visual shift in the placement of the second tab, which comes from the spacing for the close button no longer being an implicitly declared margin. I don't think it looks problematic but happy to tweak it if need be.

That one looks fine to me, I doubt anyone will really notice it 🙂

In re-testing I ran into one blocking issue which is that the horizontal scrollbar appears to no longer be available in deeply nested lists. This is more common in pretty complex templates, but here's an example with a very heavily nested series of Group blocks:

Trunk

On hover, a horizontal scrollbar is available:

2024-01-29.16.10.45.mp4

This PR

No horizontal scrollbar is available:

2024-01-29.16.11.09.mp4

Other than that, everything else appears to be testing nicely so far! It might be good to give this another rebase, too, so that we can test it in combination with some of the list view drag and drop changes that landed last week. Rebasing locally, it seems to play nicely, though 👍

@chad1008 chad1008 force-pushed the tabs-list-view-sidebar branch from 3ff66b3 to 3bd148c Compare January 29, 2024 21:34
@chad1008
Copy link
Contributor Author

thank you yet again @andrewserong for testing so thoroughly and finding the issues i'd missed!

Some of the DOM structure was off, but I've addressed that and the scrollbars should be good now!

I've also performed a fresh rebase and everything is testing well for me locally, but let me know that you think!

@chad1008 chad1008 requested a review from andrewserong January 29, 2024 21:41
Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

Wonderful, this is all testing well for me now @chad1008!

✅ Works well in a short list view
✅ In long posts and pages the windowing logic appears to be working correctly
✅ In nested lists, the horizontal scrollbar is available
✅ Keyboard behaviour when navigating between tabs and in the list view is working well
✅ Short list view expanding into a long list engages windowing logic correctly
✅ Document outline styling is correct and links work as expected
✅ Works appropriately in the site editor, too

LGTM, thanks again for all the back and forth! ✨

packages/editor/src/components/list-view-sidebar/index.js Outdated Show resolved Hide resolved
Co-authored-by: Andrew Serong <14988353+andrewserong@users.noreply.github.com>
@chad1008 chad1008 enabled auto-merge (squash) January 30, 2024 04:49
@chad1008 chad1008 merged commit a3a55bb into trunk Jan 30, 2024
56 checks passed
@chad1008 chad1008 deleted the tabs-list-view-sidebar branch January 30, 2024 05:19
@github-actions github-actions bot added this to the Gutenberg 17.7 milestone Jan 30, 2024
@chad1008
Copy link
Contributor Author

thank you again @andrewserong! This PR was greatly improved by your input. I really appreciate it.

@andrewserong
Copy link
Contributor

Any time! Likewise, thanks again for all the iterations here! 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] List View Menu item in the top toolbar to select blocks from a list of links. [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants