Skip to content

Fix accessibility prop name inconsistencies #1529

@redallen

Description

@redallen

Property names for aria attributes are inconsistent. Some examples:

  • AboutModalContainer takes the following properties: ariaLabelledbyId, ariaDescribedById. Note inconsistencies in by vs By.
  • AboutModalBox takes the raw HTML properties: aria-labelledby, aria-describedby
  • Alert takes variant and variantLabel and sets aria-label=undefined as a default property without it being an actual component property that we can typecheck.
  • I'm sure there's more...

Codebase names:

  • ariaLabel: 148
  • aria-label: 424
  • aria-controls: 10
  • ariaControls: 3
  • aria-labelledby: 74
  • ariaLabelledbyId: 10
  • aria-describedby: 18
  • ariaDescribedById: 12
  • variant: 694
  • variantLabel: 13
  • There's more... See the aria property list and use a global regex tool to spot our naming inconsistencies.

We are already mostly using the HTML properties, so I propose we introduce a breaking change to rename properties like ariaLabelledbyId to their HTML counterpart aria-labelledby. If we need to do logic with them in the component, we can rename them to camel-case in the property destructuring that already takes place using the : syntax:

{
  'variant-label': variantLabel,
  'aria-label': ariaLabel,
  'aria-labelledby': ariaLabeledBy,
  'aria-describedby': ariaDescribedBy
}

Metadata

Metadata

Assignees

Labels

A11yBreaking change 💥this change requires a major release and has API changes.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions