-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add id prop to ListView #39494
Add id prop to ListView #39494
Conversation
@@ -205,6 +207,7 @@ function ListView( | |||
blockDropTarget={ blockDropTarget } | |||
/> | |||
<TreeGrid | |||
id={ id } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this component accepts arbitrary props and spreads them onto the underlying <table>
element as ...props
. Thus we are not adding a new prop to <TreeView>
.
Size Change: +9 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
dc573c2
to
d9be0a6
Compare
Rebasin to get those tests passing |
…enus (#39290) * Navigation: try adding dedicated sidebar for managing layout of navigation menus * Fix table width to avoid overflow * Iterate on var naming and code comments * Further naming refinement * More var renaming * Rename panel title for clarity * Improve a11y of component * Revert addition of fixed table layout. Introduces too many visual bugs * Wrap items to avoid off screen movers where possible * Move additional padding * Revert id on ListView This is now handled in #39494 * Use standard getEntityRecords and remove custom entity selector Now moved to #39498 * Add handling for no data or limited data * Collapse all Nav nodes by default * Only show empty message when there are no menus * Guard against editing unpublished Menus * Select Gallery block in list view correctly * Remove rebase artifact * Add empty message in case of empty menu Co-authored-by: Dave Smith <getdavemail@gmail.com>
What?
This PR adds an
id
prop to<ListView>
. This is ultimately passed down as...props
to<TreeGrid>
and thus ends up being theid
attribute of the root<table>
element of the list view.Why?
For a11y purposes it is often important to have an
id
attribute on an element. For example if you have some kind of control that is associated with the list view then you would need to add anaria-controls
attribute to it which references theid
attribute of the list view.An example of this requirement is shown in #39290 where we need to associate the Navigation Menu dropdown
<select>
with the list view as when you select a menu it changes the list view.How?
It adds an
id
prop.Testing Instructions
id
prop:gutenberg/packages/edit-site/src/components/secondary-sidebar/list-view-sidebar.js
Lines 62 to 66 in 5c39cdb
It should look like this:
<ListView showNestedBlocks __experimentalFeatures __experimentalPersistentListViewFeatures + id="some-id" />
id
attribute is present on the List View<table>
element.Screenshots or screencast