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

h1 missing from accessibility tree #5533

Open
kangabell opened this issue Jan 28, 2025 · 1 comment
Open

h1 missing from accessibility tree #5533

kangabell opened this issue Jan 28, 2025 · 1 comment
Labels
♿ a11y Accessibility

Comments

@kangabell
Copy link
Collaborator

There is an h1 on the page, but it is within a container set to display:none for some viewport sizes. This means the screen reader cannot access it, and it is not listed in the VoiceOver rotor in the Headings panel.

Testing Environment

http://159.89.83.1/c/new

WCAG Criteria

2.4.6 Headings and Labels - AA

Testing Method

Manual - VoiceOver, Chrome, MacOS

Screenshot

browser inspector showing a container set to display none that the h1 is inside of

Relevant Code Snippet

<div class="bg-token-main-surface-primary sticky top-0 z-10 flex min-h-[40px] items-center justify-center bg-white pl-1 dark:bg-gray-800 dark:text-white md:hidden">...<h1 class="flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-center text-sm font-normal">New Chat</h1>...</div>

Recommended Action

Move the h1 outside of the container, and hide it visually using a css utilitiy like the .sr-only class. Alternatively, don't hide the container or the h1 inside of it at all.

@danny-avila danny-avila added the ♿ a11y Accessibility label Jan 29, 2025
@derekjackson-das
Copy link
Collaborator

derekjackson-das commented Jan 31, 2025

This <div> is hidden because it contains the responsive header/navigation and the related class is part of the media query min-width: 768px. The <h1> will be visible when the screen width is below 768px along with the mobile menu and new chat buttons:

@media (min-width: 768px) {
    .md\:hidden {
        display: none;
    }
}
screen shot showing the H1 visible in the mobile view of the application that reads 'new chat'.

However, using an <h1> in the application's desktop view is still a useful suggestion. If a dynamic h1 can be provided that matches the current chat in the same way the mobile h1 is created, then it could be a very useful navigation feature in the wider, desktop view also. This could be a .sr-only element so that it is a visually hidden heading, but consider that it may be useful to others as well who do not use a screen reader but benefit from clear, explicit way finding indicators.

Something like this:

libre chat's desktop view with an H1 displayed at the top of the chat thread reading 'States that start with A'

That is similar to the mobile view:

libre chat's mobile view with the H1 displayed at the top of the screen reading 'States that start with A'

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