fix(core): set aria-disabled and tabindex on Button when disabled #213
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_archipelagos!213
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_button_disabled_attribute"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The shared
ButtonandIconButtoncomponents rendered thehero-btn-disabledclass but no a11y/keyboard semantics, so disabled buttons stayed in the tab order, were not announced as disabled by screen readers, and programmaticbtn.click()was only stopped by the in-handler guard. This PR addsaria-disabledandtabindexdriven by the same state used for the disabled CSS class.The HTML
disabledattribute is still intentionally not set, per the existing design constraint in the component (UA grey would override the variant background colors).Related Issue
Closes #184
Changes
Buttoncomponent: emitaria_disabledandtabindexattributes that flip with the existingis_disabled = props.disabled || props.loadinglocal. Existing comment updated to mention the new a11y attributes.IconButtoncomponent: samearia_disabledandtabindexwiring tied toprops.disabled. Existing comment retained.hero-btn-disabled/hero-icon-btn-disabledCSS class logic is unchanged, so visual styling is preserved.if !is_disabled { props.onclick.call(e); }is preserved as defense-in-depth and continues to block programmatic clicks when disabled.No CSS changes were needed because the HTML
disabledattribute is intentionally not set — variant background and color rules continue to apply.Test Results
cargo test -p hero_archipelagos_core— 8/8 unit tests + 1 doctest passing.cargo check --workspace— clean (no new warnings).aria-disabled="true",tabindex="-1",hero-btn-disabledclass."hello"input → send button flips toaria-disabled="false",tabindex="0", no disabled class.btn.click()while disabled → onclick guard preventshandle_sendfrom firing (chat input remains untouched).disabledattribute isfalse#184