Repository navigation
Fix missing role on action items - #120
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 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 anHref, 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. 8000 ul>
| 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request improves accessibility for the
Dropdown,Pagination, andToolbarcomponents by ensuring that action-only items (those without anHref) are rendered withrole="button", addressing the lack of an implicit ARIA role for anchor tags withouthref. It also updates documentation and test files to reflect and verify this behavior.Accessibility improvements:
BitDropdownItem,BitPageItem, andBitToolbarItemcomponents now renderrole="button"on<a>elements without anHref, regardless of enabled or disabled state, and remove the role when anHrefis present. This ensures proper ARIA semantics for screen readers and keyboard navigation. [1] [2] [3]Documentation updates:
dropdown.md,pagination.md, andtoolbar.mdto document the new accessibility behavior for items withoutHref, clarifying whenrole="button"is applied. [1] [2] [3]Testing enhancements:
BitDropdownTest.Rendering.razorandBitPaginationTest.Rendering.razorto expect and verify the presence or absence ofrole="button"as appropriate. Added new tests to cover all combinations of enabled/disabled and with/withoutHref. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]