fix(a11y): make span metrics badges focusable to render tooltip content#877
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThe pull request modifies the 🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. Comment |
| <component | ||
| :is="typesHref ? NuxtLink : 'span'" | ||
| :to="typesHref" | ||
| :tabindex="!typesHref ? 0 : undefined" |
There was a problem hiding this comment.
This line is highlighted by the Codecov report as an issue.
I've kept it for now as it's similar to :is="typesHref ? NuxtLink : 'span'" already in the file.
I could possibly fix it with something like the following, but I preferred some guidance from the maintainers before changing anything to my initial fix :)
<script>
const typesTabIndex = computed(() => {
return !typesHref.value ? 0 : undefined
})
</script>
<component
:tabindex="typesTabIndex"
>
</component>Note: feel free to modify directly my branch if it's quicker while you're reviewing.
On https://npmx.dev/package/bootstrap, three metric badges are displayed:
All three badges show informative tooltips on hover. However, only "Types" is keyboard-focusable, preventing keyboard users from accessing the ESM and CJS tooltip information. This creates an accessibility barrier for keyboard navigation:
Screen.Recording.2026-02-03.at.21.25.58.mov
Adding
tabindex="0"to the span elements makes all badges keyboard-focusable so that tooltip content is accessible to all users:Screen.Recording.2026-02-03.at.21.27.12.mov
Please note that "Types" is not always a link, and can be a span too when the package has no type. You can check the rendering with https://npmx.dev/package/@ng-bootstrap/ng-bootstrap.
The focus ring rendering is different, but I know there are other issues reported to tackle this specific issue globally.