Skip to content

Conversation

@wuyiping0628
Copy link
Collaborator

@wuyiping0628 wuyiping0628 commented Feb 9, 2026

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features
    • Enhanced link component accessibility with improved screen reader support, keyboard navigation handling, and proper disabled state management for users relying on assistive technologies.

@github-actions github-actions bot added the enhancement New feature or request (功能增强) label Feb 9, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 9, 2026

Walkthrough

Enhanced accessibility of a Vue link component by adding ARIA attributes (aria-disabled, tabindex, aria-label, aria-hidden) to the anchor and icon elements for improved keyboard navigation and screen reader support.

Changes

Cohort / File(s) Summary
Accessibility Enhancements
packages/vue/src/link/src/pc.vue
Added aria-disabled binding to anchor element, set tabindex to -1 when disabled, bound aria-label from component attributes or link value, and added aria-hidden="true" to icon component for improved keyboard navigation and screen reader compatibility.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A link now speaks with clearer voice,
With labels guiding every choice,
Tab-stops adjusted, icons hidden,
Accessibility sweetly written!
*hops with delight*

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(link): add aria-* attribute' accurately describes the main change in the pull request, which adds accessibility-related bindings (aria-disabled, aria-label, aria-hidden) to the link component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch wyp/aria-link-0209

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@packages/vue/src/link/src/pc.vue`:
- Around line 29-35: The template currently sets aria-hidden="true" on the
<component :is="icon" ... /> which hides icon-only links from AT when there is
no text (slots.default or value) and no aria-label; update the logic so
aria-hidden is only applied when there is visible text (i.e., when slots.default
|| value is truthy), otherwise do not set aria-hidden and instead surface a
dev-time warning if neither value, slots.default nor an explicit aria-label is
provided; locate the icon-rendering component in the template (the <component
:is="icon" ... />) and implement the conditional aria-hidden and warning (use
process.env.NODE_ENV or a similar dev check) so icon-only links remain
accessible by default.
- Around line 25-27: The v-bind spread with a($attrs, ['^on[A-Z]']) duplicates
aria-label because $attrs already includes it; update the spread to exclude
aria-label (e.g., add 'aria-label' to the exclusion list passed to
filterAttrs/a) so the component only sets aria-label once via the explicit
:aria-label="$attrs['aria-label'] || value", or alternatively remove the
explicit binding and rely on the spread — modify the call site of a(...) in the
template to exclude 'aria-label' to eliminate redundancy.

@zzcr zzcr merged commit cb743eb into dev Feb 9, 2026
14 of 26 checks passed
@zzcr zzcr deleted the wyp/aria-link-0209 branch February 9, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request (功能增强)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants