Skip to content

Commit

Permalink
fix: fixing the issue of errors caused by multiple values in the role…
Browse files Browse the repository at this point in the history
…. When multiple values are set in the role, only the first value is returned.

fix withastro#9856
  • Loading branch information
岳代平 committed Jan 29, 2024
1 parent 70fdf1a commit 52911a5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,8 @@ function menuitem_implicit_role(attributes: Record<string, string>) {

function getRole(element: Element): ARIARoleDefinitionKey | undefined {
if (element.hasAttribute('role')) {
return element.getAttribute('role')! as ARIARoleDefinitionKey;
const roleText = element.getAttribute('role')!;
return roleText.slice(0, roleText.indexOf(' ')) as ARIARoleDefinitionKey;
}
return getImplicitRole(element) as ARIARoleDefinitionKey;
}
Expand Down

0 comments on commit 52911a5

Please sign in to comment.