-
Notifications
You must be signed in to change notification settings - Fork 4.7k
DataViews: Remove table row click-to-select and hover styles #73873
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
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: -304 B (-0.01%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
|
I think if there's ever a time to try this, it's now at this part in the cycle, so for that reason I'm a 👍 👍 |
Doing this will disable multi-selection in the table view, so I'm not sure if we should disable all interactions. See #70891 cc @talldan Additionally, the primary actions are not displayed on mouse hover, making them very inaccessible. Additionally, the primary action is visually hidden, but still clickable, which is confusing. Perhaps the primary action should stay as it is now. 5f59fbfdd92c48b2b1d5841e841bdb00.mp4 |
I think the intention of the PR is that multiselection is only possible via the checkboxes. The shortcut is hard to discover, so I expect a lot of users might already be using the checkbox for this purpose. |
|
Some tests need to be updated/removed. |
|
Thanks for testing y'all. I fixed the primary action button visibility issue. I also restored the cmd/ctrl click behavior. The main point of confusion is what happens when clicking a row, so it seems reasonable to leave this behavior in as a power-user feature, especially as it is a common UX pattern. @talldan I did notice that this isn't working in Firefox though 🤔 |
I wouldn't mind removing this as well. It feels a bit confusing to leave this one for bulk actions but not having the click-select behavior. |
|
The main reason I favor leaving cmd/ctrl click (for now at least) is that it's an extremely common UX pattern. The main problem this PR sought to address is the ambiguity around regular row clicks for which there isn't really a standard convention. I wouldn't necessarily object to removing it if there's strong feelings, but maybe in a separate PR? |
| border-bottom: 0; | ||
| } | ||
|
|
||
| &.is-hovered, |
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.
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.
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.
I fixed the hover state:
But I couldn't find a great solution for the issue on trunk. I think that one probably needs a dedicated PR. I'll open an issue.
Edit: I checked how this works in 6.9 and noticed the column just has a background color:
This was my 'not great' solution 😅 So I guess it's fine to patch it this way for now, and explore a better fix separately.
ntsekouras
left a comment
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.
LGTM, thanks!
|
Flaky tests detected in d3f9bc4. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20239297741
|
|
@oandregal would you mind checking I updated the grid tests correctly in 3dfb9aa? |
| <DataViewWrapper | ||
| view={ { | ||
| ...DEFAULT_VIEW, | ||
| type: 'grid', |
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.
It seems both of these tests under grid where testing the default view with table layout, and they were actually identical to the ones above - so not needed.
The changes here look good now.
The addition of the mediaField made me realize that we don't render checkboxes without one. That doesn't seem right and I'd expect it to have been discussed already..
Can you loop me in about this and maybe an existing plan? Is mediaField required? I just tried in pages in trunk and you can remove the Featured Image from the view options and then there are no checkboxes and no visual indication that we have items selected.
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.
Yeah I was surprised by that as well. I wonder if it's related to the DataViewsPicker work. Since it's an issue on trunk do you think we should explore separately?
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.
Of course separately. It's out of scope for this PR. We can land this one.
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.
I opened an issue about the checkbox in grid layout: #74046


As suggested in #73248 (comment)...
What
Removes the click-to-select behavior on table rows and all hover styles. Rows are no longer interactive; selection is only via checkboxes.
Why
Interactive table rows are ambiguous. Users are never sure whether clicking a row will navigate or select. Additionally the selection mechanic is also ambiguous. Removing all row click interactions is the safest way to ensure clarity.
How
onClickhandler from<tr>that toggled bulk-select checkboxesisHovered,handleMouseEnter,handleMouseLeave).is-hoveredbackground colors and:hoverstyles)isTouchDeviceRef,onTouchStart, and theisAppleOSimport:focus-withinstyles so action buttons remain visible on keyboard focus for accessibilityThe bulk-select checkbox remains the only way to select items, and interactive elements remain accessible via keyboard navigation.
Testing
npm run storybook