Skip to content

Conversation

@uptimeZERO
Copy link
Contributor

Proposed change

Updating ha-list usages to set the correct role when used as a checklist/radiolist and also setting default role.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@uptimeZERO uptimeZERO linked an issue Dec 24, 2025 that may be closed by this pull request
3 tasks
Comment on lines +9 to +13
constructor() {
super();
if (this.innerRole == null) this.innerRole = "list";
if (this.itemRoles == null) this.itemRoles = "listitem";
}
Copy link
Member

@bramkragten bramkragten Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't set default values like this, but use:

  @property() public innerRole: string | null = "list";

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a good idea, but I view setting a default like this as dangerous and out of scope for just fixing menus with radios/checkboxes and remove it from this PR. There are just too many lists this would affect and impossible to test them all.

></search-input>
</ha-dialog-header>
<ha-list multi>
<ha-list multi innerRole="menu" itemRoles="menuitemcheckbox">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test if this works? As the child of ha-list is lit-virtualizer my guess is that the items in the virtualizer are not targeted by this.

@bramkragten
Copy link
Member

Is there anyone that has much experience with aria-roles? @steverep maybe? When should you use a menu role and what should you do with lists that have checkbox or radio boxes in them?

@bramkragten
Copy link
Member

@uptimeZERO there is a merge conflict

@steverep
Copy link
Member

@bramkragten I can make time to pull this branch and test it, but not for several days at least given the holidays.

@uptimeZERO if you tested this with a screen reader/OS, please describe. These roles are difficult to get right and I think this should be tested thoroughly. Thank you for the effort and I'll do my best to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility of menus with radio or checkbox items

4 participants