8000 Fix missing role on action items by albx · Pull Request #120 · albx/bitblazor · GitHub
[go: up one dir, main page]

Skip to content

Fix missing role on action items - #120

Merged
albx merged 2 commits into
mainfrom
bugifx/105-dropdown-missing-role
Nov 4, 2026
Merged

albx merged 2 commits into
mainfrom
bugifx/105-dropdown-missing-role

Conversation

@albx
@albx albx commented Nov 4, 2026
Copy link
Copy Markdown
Owner

This pull request improves accessibility for the Dropdown, Pagination, and Toolbar components by ensuring that action-only items (those without an Href) are rendered with role="button", addressing the lack of an implicit ARIA role for anchor tags without href. It also updates documentation and test files to reflect and verify this behavior.

Accessibility improvements:

  • BitDropdownItem, BitPageItem, and BitToolbarItem components now render role="button" on <a> elements without an Href, regardless of enabled or disabled state, and remove the role when an Href is present. This ensures proper ARIA semantics for screen readers and keyboard navigation. [1] [2] [3]

Documentation updates:

  • Updated dropdown.md, pagination.md, and toolbar.md to document the new accessibility behavior for items without Href, clarifying when role="button" is applied. [1] [2] [3]

Testing enhancements:

  • Adjusted test renderings in BitDropdownTest.Rendering.razor and BitPaginationTest.Rendering.razor to expect and verify the presence or absence of role="button" as appropriate. Added new tests to cover all combinations of enabled/disabled and with/without Href. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

@albx albx linked an issue Nov 4, 2026 that may be closed by this pull request
@albx
albx requested a balanced review from Copilot November 4, 2026 17:53
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Toolbar actions remain unreachable by Tab when no Href is set, and pagination items announced as buttons lack Space activation and scroll suppression.

2 open issues
What changed in this PR

This PR updates BitBlazor’s Dropdown, Pagination, and Toolbar components to expose action-only items with button semantics while preserving native link semantics for items with an Href.

Changes:

  • Apply role="button" to items without an Href, whether enabled or disabled.
  • Update rendering expectations and add role checks for enabled/disabled items with and without links.
  • Document the role behavior for all three components.
  • File Description
    tests/​BitBlazor.Test/​Components/​Toolbar/​BitToolbarTest.Rendering.razor Updates expected markup and adds toolbar role tests.
    tests/​BitBlazor.Test/​Components/​Pagination/​BitPaginationTest.Rendering.razor Updates expected markup and adds pagination role tests.
    tests/​BitBlazor.Test/​Components/​Dropdown/​BitDropdownTest.Rendering.razor Updates expected markup and adds dropdown role tests.
    src/​BitBlazor/​Components/​Toolbar/​BitToolbarItem.razor.cs Sets the item role based on Href.
    src/​BitBlazor/​Components/​Pagination/​BitPageItem.razor.cs Sets the page-item role based on Href.
    src/​BitBlazor/​Components/​Dropdown/​BitDropdownItem.razor.cs Separates role assignment from disabled-state handling.
    docs/​components/​toolbar.md Documents toolbar item accessibility attributes.
    docs/​components/​pagination.md Documents page-item role behavior.
    docs/​components/​dropdown.md Documents dropdown item role behavior.

Review effort: Balanced

@albx
albx merged commit b8a0e44 into main Nov 4, 2026
5 checks passed
@albx
albx deleted the bugifx/105-dropdown-missing-role branch November 4, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] BitDropdownItem missing role="button" on enabled action-only items

2 participants

0