Media Fields: Fix filename truncation with Tooltip#78453
Conversation
|
Size Change: +132 B (0%) Total Size: 7.97 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in 12c1b0f. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26137264965
|
| @@ -0,0 +1,14 @@ | |||
| // CSS-based truncation (rather than `__experimentalTruncate`) so the full | |||
| // filename stays in the DOM — keeps it available to assistive technology | |||
There was a problem hiding this comment.
I noticed some components now using <WCText truncate> around the place. Looks like it's not recommended yet: https://wordpress.github.io/gutenberg/?path=/docs/components-text--docs
There was a problem hiding this comment.
Cheers, we can revisit further down the track if/when it's recommended 👍
|
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. |
|
Thanks for the quick review! 🙇 |


What?
Update how the filename field truncates its text by avoiding a tab stop while ensuring the full filename is still accessible to screen readers.
Part of:
And addresses the review feedback in: #78423 (comment) from @talldan (thanks for catching it!)
Why?
The previous approach of using
Tooltipwithout explicitly settingtabIndex={ -1 }on its child meant that in the DataViewsPicker the filename field would receive an extra tab stop while navigating across the media modal by keyboard.This is unexpected and particularly in large lists makes it harder to navigate around the media library.
From comparing some other web apps, it turns out that in web apps like Google Drive, truncated titles are available via a tooltip on hover, but don't result in a tab stop. By adjusting the filename field to use CSS truncation instead of
Truncate, we can take a similar approach here while ensuring the full filename is still reachable to screen readers.How?
Truncateusage and instead use aspanwith CSS truncationtabIndex={ -1 }to prevent the tab stopTesting Instructions
Screenshots or screencast
It should look like this, with no tab stop:
Use of AI Tools
Claude Code