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

With ui.sidebar_menu_foldable = true enabled keyboard focus moves to hidden menu items #1022

Closed
jasonday opened this issue May 24, 2022 · 6 comments

Comments

@jasonday
Copy link
Contributor

Current behavior:
With ui.sidebar_menu_foldable = true enabled, when using the keyboard only, focus is placed on submenu items that are not visible.

Expected behavior:
Only visible elements in the menu are able to receive focus.

@raum51
Copy link
Contributor

raum51 commented May 26, 2022

I'll take a look on this issue (hopefully next week).

@jasonday
Copy link
Contributor Author

jasonday commented May 26, 2022

@raum51 thanks.

The issue comes down to how the foldable items are being hidden. In looking at the CSS, the height is being transitioned from max-height: 0 to max-height: 100000vmax which doesn't actually hide the content other than visually. Making a display adjustment immediately fixes the issue, but you lose the expanding height transition:

nav.foldable-nav input:checked~ul.foldable {
    display: block;
    max-height: 100000vmax;
    transition: max-height 1s ease-in-out;
}

nav.foldable-nav ul.foldable {
    max-height: 0;
    overflow: hidden;
    transition: max-height .5s cubic-bezier(0,1,0,1);
    display: none;
}

For accessibility reasons, things must be hidden using display: none otherwise the elements are still accessible via keyboard & screen reader. See: https://accessibility.18f.gov/hidden-content/

jasonday added a commit to jasonday/docsy that referenced this issue May 26, 2022
The foldable sidebar nav is using `max-height` transitions to hide subnavs visually, but this approach does not hide visually hidden content from keyboard and screen reader users. Moving to a simple `display: [block/none]` toggle solves the issue.
LisaFC added a commit that referenced this issue Jun 30, 2022
* Fixing docsy issue #1022 - accessibility of foldable sidebar nav

The foldable sidebar nav is using `max-height` transitions to hide subnavs visually, but this approach does not hide visually hidden content from keyboard and screen reader users. Moving to a simple `display: [block/none]` toggle solves the issue.

* Improves accessibility of imgproc

To be more semantically aligned and to improve accessibility, I propose using <figure> and <figcaption> for images included in this manner, which creates a programmatic association between the image and the additional text, providing more context for screen readers

Co-authored-by: LisaFC <lcarey@google.com>
fekete-robert pushed a commit to fekete-robert/docsy that referenced this issue Sep 13, 2022
* Fixing docsy issue google#1022 - accessibility of foldable sidebar nav

The foldable sidebar nav is using `max-height` transitions to hide subnavs visually, but this approach does not hide visually hidden content from keyboard and screen reader users. Moving to a simple `display: [block/none]` toggle solves the issue.

* Improves accessibility of imgproc

To be more semantically aligned and to improve accessibility, I propose using <figure> and <figcaption> for images included in this manner, which creates a programmatic association between the image and the additional text, providing more context for screen readers

Co-authored-by: LisaFC <lcarey@google.com>
@kimberleybrown
Copy link

Bumping this topic up to see if a fix was applied for this. We recently had an accessibility audit and this issue in particular was still being flagged.

@jasonday
Copy link
Contributor Author

jasonday commented Mar 9, 2023

yes this was merged - #1028

@chalin
Copy link
Collaborator

chalin commented Mar 9, 2023

Is this closed by #1028?

@jasonday
Copy link
Contributor Author

jasonday commented Mar 9, 2023

Yes. Verified code at line 151 - https://github.com/google/docsy/blob/main/assets/scss/_nav.scss#L151

@jasonday jasonday closed this as completed Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants