You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BitDropdownItem only sets role="button" (and aria-disabled="true") when Disabled is true. When an item is used as a pure action (no Href, only OnClick) and is enabled, it renders as an <a> element with no href attribute and no explicit role.
Per the HTML-AAM / ARIA mapping, an <a> without an href attribute has no implicit ARIA role (it maps to role=generic), even though the element is still made focusable via an explicit tabindex="0". As a result, assistive technology has no reliable way to announce the item as an interactive control (button/link) — this is a WCAG 4.1.2 (Name, Role, Value) violation for enabled, action-only dropdown items.
This was discovered while reviewing whether BitDropdownItem should render as a <button> instead of an <a>. Switching the element type is not advisable (Bootstrap Italia's CSS uses tag-qualified selectors like a.dropdown-item / a.list-item, and the rest of the library — BitPageItem, BitToolbarItem, BitBottomNavItem — follows the same "always <a>" convention). The actual fix should be scoped to correcting the missing role for the enabled, no-Href case, but this needs further investigation to confirm the right approach and check for the same pattern elsewhere in the library.
Render a BitDropdown with a BitDropdownItem that has no Href set and only an OnClick callback (e.g. the page-size changer items in BitPagination's ShowChanger feature).
Inspect the rendered HTML of the enabled item.
Observe the <a> element has no href and no role attribute.
Inspect the same item with a screen reader (e.g. NVDA) — it is not announced as a button or link, only as plain focusable text.
Expected behavior
Enabled, action-only BitDropdownItem instances (no Href, OnClick set) should always expose role="button" regardless of the Disabled state, so assistive technology can correctly announce the control's role. Items with a real Href should keep native <a> link semantics (no explicit role needed).
Screenshots
N/A
Desktop (please complete the following information):
OS: N/A (applies to all)
Browser: N/A (applies to all)
Version: N/A
Additional context
This needs investigation before implementing a fix. Confirm whether the same missing-role gap exists on other Href-optional item components (BitPageItem, BitToolbarItem, BitBottomNavItem), and whether the fix should be a shared helper rather than a one-off change in BitDropdownItem.
Do not convert BitDropdownItem to a native <button> element — Bootstrap Italia's CSS relies on tag-qualified selectors (a.dropdown-item, a.list-item), and the rest of the library follows the same anchor-based convention.
Describe the bug
BitDropdownItemonly setsrole="button"(andaria-disabled="true") whenDisabledistrue. When an item is used as a pure action (noHref, onlyOnClick) and is enabled, it renders as an<a>element with nohrefattribute and no explicitrole.Per the HTML-AAM / ARIA mapping, an
<a>without anhrefattribute has no implicit ARIA role (it maps torole=generic), even though the element is still made focusable via an explicittabindex="0". As a result, assistive technology has no reliable way to announce the item as an interactive control (button/link) — this is a WCAG 4.1.2 (Name, Role, Value) violation for enabled, action-only dropdown items.This was discovered while reviewing whether
BitDropdownItemshould render as a<button>instead of an<a>. Switching the element type is not advisable (Bootstrap Italia's CSS uses tag-qualified selectors likea.dropdown-item/a.list-item, and the rest of the library —BitPageItem,BitToolbarItem,BitBottomNavItem— follows the same "always<a>" convention). The actual fix should be scoped to correcting the missingrolefor the enabled, no-Hrefcase, but this needs further investigation to confirm the right approach and check for the same pattern elsewhere in the library.Relevant code:
BitDropdownItem.razor.cs, methodSetDisabled():To Reproduce
Steps to reproduce the behavior:
BitDropdownwith aBitDropdownItemthat has noHrefset and only anOnClickcallback (e.g. the page-size changer items inBitPagination'sShowChangerfeature).<a>element has nohrefand noroleattribute.Expected behavior
Enabled, action-only
BitDropdownIteminstances (noHref,OnClickset) should always exposerole="button"regardless of theDisabledstate, so assistive technology can correctly announce the control's role. Items with a realHrefshould keep native<a>link semantics (no explicitroleneeded).Screenshots
N/A
Desktop (please complete the following information):
Additional context
Href-optional item components (BitPageItem,BitToolbarItem,BitBottomNavItem), and whether the fix should be a shared helper rather than a one-off change inBitDropdownItem.BitPaginationShowChangerfeature ([FEATURE] Pagination - Add Changer section (records per page dropdown) #95), which rendersBitDropdownIteminstances withoutHreffor page-size selection.BitDropdownItemto a native<button>element — Bootstrap Italia's CSS relies on tag-qualified selectors (a.dropdown-item,a.list-item), and the rest of the library follows the same anchor-based convention.