Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MainMenu]: page crashes when WAVE accessibility browser extension is enabled #2715

Open
vasilii-kovalev opened this issue Dec 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@vasilii-kovalev
Copy link
Collaborator

Description

When enabling WAVE browser extension, the page crashes, when MainMenu component is present.

Steps to Reproduce

  1. Install the WAVE extension
  2. Go to any UUI documentation page
  3. Enable the extension and observe the results
  4. Reload the page
  5. Remove MainMenu component from the DOM via DevTools (XPath: /html/body/div/div[1]/header/nav)
  6. Enable the extension and observe the results

Actual result

Step 3:
Crashed page after enabling WAVE browser extension

Step 6:
Correctly displayed page after enabling WAVE browser extension

Expected result

The page is rendered correctly with inserted labels on steps 3 and 6.

Environment

  • UUI version: latest
  • Browser name: Google Chrome v.131.0.6778.205
  • Operating System: Windows 10 64-bit
@vasilii-kovalev vasilii-kovalev added the bug Something isn't working label Dec 26, 2024
@vasilii-kovalev
Copy link
Collaborator Author

Please, add "A11y" label, if necessary.

@AlekseyManetov
Copy link
Collaborator

Fixed. The issue occurred because the Wave extension modifies the DOM structure when enabled, adding its own nodes for errors and other information. In this case, Wave added nodes for an "Empty button" error inside the MainMenu. Since the MainMenu uses the AdaptivePanel to measure and layout items, this 'unexpected invasion' caused the error.

I resolved the issue by adding an aria-label attribute to the icon button to fix the "Empty button" error. If you encounter a similar issue in your app, ensure that all MainMenu buttons have either a caption or an aria-label attribute.

@AlekseyManetov AlekseyManetov moved this from Backlog to In testing in UUI Project Board Jan 3, 2025
@vasilii-kovalev
Copy link
Collaborator Author

vasilii-kovalev commented Jan 9, 2025

Thank you! It does work for GlobalMenu, MainMenuButton and MainMenuIcon components, but it doesn't work for MainMenuAvatar, because it doesn't accept rawProps or attributes as component's props. Currently, I set aria-label via ref like this:

const avatarRef = useRef<HTMLButtonElement | null>(null);

useEffect(
  () => {
    avatarRef.current?.setAttribute(
      "aria-label",
      "User avatar",
    );
  },
  [],
);

// ...

<MainMenuAvatar
  ref={avatarRef}
  // Other props
/>

To simplify this case, it would be great to add rawProps support to it, or allow passing button element's attributes as props.

@AlekseyManetov
Copy link
Collaborator

To simplify this case, it would be great to add rawProps support to it, or allow passing button element's attributes as props.

Thanks, we already noticed this case too. We will add that fix in next release.

@NatalliaAlieva NatalliaAlieva moved this from In testing to Ready to release in UUI Project Board Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready to release
Development

No branches or pull requests

2 participants