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

Redundant Button Element in 'New Chat' Link #4097

Closed
derekjackson-das opened this issue Sep 17, 2024 · 1 comment
Closed

Redundant Button Element in 'New Chat' Link #4097

derekjackson-das opened this issue Sep 17, 2024 · 1 comment
Assignees
Labels
a11y Accessibility

Comments

@derekjackson-das
Copy link
Collaborator

Issue Description:
The "New Chat" link also contains a button element that serves a redundant purpose. The repeated UI is not necessary and is more likely to lead to confusion.

WCAG Criteria:
4.1.1 Parsing - A

Code Snippet:

<a href="/" tabindex="0" data-testid="nav-new-chat" class="group flex h-10 items-center gap-2 rounded-lg px-2 font-medium transition-colors duration-200 hover:bg-surface-hover" aria-label="New chat">
  <div class="h-7 w-7 flex-shrink-0">
    <div class="icon-xl relative flex h-full overflow-hidden rounded-full" style="width: 100%; height: 100%;">
      <img src="https://static.sandbox.ai.huit.harvard.edu/img/openai-logomark.png" alt="GPT-4o" class="object-cover" style="width: 100%; height: 100%;">
    </div>
  </div>
  <div class="grow overflow-hidden text-ellipsis whitespace-nowrap text-sm text-text-primary">New chat</div>
  <div class="flex gap-3">
    <span class="flex items-center" data-state="closed">
      <button id="nav-new-chat-btn" aria-label="New chat" class="text-text-primary" data-state="closed"></button>
    </span>
  </div>
</a>
Screenshot 2024-09-17 at 4 13 03 PM

Notes:
In this case, the button is not necessary, and the link can handle the "New Chat" action via one interactive element, which would result in a cleaner UI and align with the pattern of the rest of the Chat History.

  • A simple way to fix this would be to add aria-hidden="true" to the button element to hide it from the Accessibility API and also add tabindex="-1" to remove it from the focus order. This leaves the button but essentially makes it inoperable or discoverable by AT.
  • A more robust solution would be to remove the button element while the icon can remains as part of the anchor (but it should remain hidden as well with aria-hidden attribute).
@danny-avila
Copy link
Owner

Closed by #4091

Recording.2024-09-21.225456.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Accessibility
Projects
None yet
Development

No branches or pull requests

3 participants