dusk-network / dusk-network/duskit
refactor(components): migrate interactive states from BEM modifiers to ARIA attributes and native pseudo-classes
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Description
Rationale
Currently, our components manage interactive and behavioral states using custom BEM modifier classes (e.g., .dusk-tab--selected, .dusk-button--pressed). This approach introduces a dangerous duplication of the source of truth. It decouples the visual presentation governed by CSS from the actual functional and semantic state declared in the DOM for assistive technologies (such as screen readers).
To eliminate this synchronization overhead and prevent accessibility drift, we are shifting to a hybrid architectural model:
- Anatomy & Taxonomy: Governed strictly by BEM conventions (e.g., blocks, elements, and structural variants like
.dusk-button--variant--naked). - State & Behavior: Governed exclusively by native CSS pseudo-classes (
:disabled,:invalid) and standard ARIA attributes ([aria-selected="true"],[aria-expanded="true"]).
By linking our style rules directly to ARIA attributes and native states, the visual interface can never lie about its operational state.
Scope of Work & Component Audit Checklist
We need to audit @duskit/components and migrate the following state patterns from BEM modifiers to semantic DOM attributes:
- Button States (
Button.css/Button.svelte)
- Target: Compressed toggles and disabled anchors.
- Migration: Replace
.dusk-button--pressedwith[aria-pressed="true"]. Replace.dusk-anchor-button--disabledwith[aria-disabled="true"].
- Selection States (Tabs, Segmented Controls, Listbox)
- Target: Actively selected interactive items.
- Migration: Search for patterns like
.dusk-tab--selectedor.dusk-list-item--activeand refactor the CSS to match[aria-selected="true"].
- Expansion States (Accordion, Dropdown, Menu)
- Target: Visibility toggles for disclosure structures.
- Migration: Search for classes like
.dusk-dropdown--openor.dusk-accordion--expandedand bind the styles directly to[aria-expanded="true"].
- Validation States (Input, Select, Textarea)
- Target: Form controls reflecting validation failures.
- Migration: Remove custom modifiers like
.dusk-input--erroror.dusk-input--invalid. Rely on the native:invalidpseudo-class for HTML5 constraints or[aria-invalid="true"]for custom business logic validation.
- Activation States (Toggle, Switch)
- Target: Binary state controls without hidden native inputs.
- Migration: Eliminate classes such as
.dusk-switch--onor.dusk-switch--checkedin favor of[aria-checked="true"].
- Navigation States (Navigation menus, Link lists)
- Target: Highlighting the link corresponding to the current location.
- Migration: Replace semantic markers like
.dusk-nav-link--currentwith the official standard[aria-current="page"](or applicable token values likestep,location).
IMPORTANT: the Table component is using a duskit-table__cell--hidden class instead of an aria attribute. Correct this and check for similar cases.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by auditing @duskit/components, beginning with Button.css and Button.svelte, then inspect the listed selection, expansion, validation, activation, navigation, and Table components for state modifier classes. Replace the specified visual-state selectors with the corresponding ARIA attributes or native pseudo-classes, including the Table hidden-cell case. Done means the audited components use semantic state selectors without the old state modifiers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- accessibility, frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100