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

SideNav - Disable keyboard navigation/focus of hidden elements #1909

Merged
merged 5 commits into from
Feb 9, 2024

Conversation

alex-ju
Copy link
Member

@alex-ju alex-ju commented Jan 26, 2024

📌 Summary

Currently, interactive elements within the SideNav are focusable even when the SideNav is minimized/collapsed. This makes them visible and interactive to screen-reader users even though they are not visible.

The usual and easiest way to fix this issue is to set display: none on such elements. However, because of the desired fade effect, we can't use this method and we rely on changing the visibility of these containers. To fix this issue while preserving the fade effect, we make inert the containers potentially holding such interactive elements.

To facilitate the review of this feature I resurrected the demo app previously used for other SideNav improvements.

🔗 External links

Jira ticket: HDS-2936


👀 Component checklist

💬 Please consider using conventional comments when reviewing this PR.

Copy link

vercel bot commented Jan 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
hds-showcase ✅ Ready (Inspect) Visit Preview Feb 9, 2024 11:12am
hds-website ✅ Ready (Inspect) Visit Preview Feb 9, 2024 11:12am

@alex-ju alex-ju changed the title SideNav - fixed navigation elements remaining interactive when minimized SideNav - fix navigation elements remaining interactive when minimized Jan 26, 2024
@alex-ju alex-ju changed the title SideNav - fix navigation elements remaining interactive when minimized SideNav - Disable keyboard navigation/focus of hidden elements Jan 26, 2024
Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a praise and... a question (sorry). 😀

@@ -9,10 +9,10 @@
<div class="hds-side-nav__wrapper-header">
{{yield to="header"}}
</div>
<div class="hds-side-nav__wrapper-body">
<div class="hds-side-nav__wrapper-body" inert={{@isMinimized}}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and neat! 🙌

packages/components/addon/components/hds/side-nav/base.hbs Outdated Show resolved Hide resolved
Copy link
Contributor

@MelSumner MelSumner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a tidy approach, nice thinking!

@alex-ju alex-ju marked this pull request as draft February 7, 2024 10:41
Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a couple of comments, but I am happy with the solution

let me know when the comments are resolved that I'll approve

"@hashicorp/design-system-components": patch
---

`SideNav` - fixed navigation elements remaining interactive when minimized
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`SideNav` - fixed navigation elements remaining interactive when minimized
`SideNav` - fixed issue with navigation elements remaining interactive when minimized

packages/components/src/components/hds/side-nav/index.js Outdated Show resolved Hide resolved
let { onToggleMinimizedStatus } = this.args;

if (typeof onToggleMinimizedStatus === 'function') {
onToggleMinimizedStatus(this.isMinimized);
}
}

@action
didInsert(element) {
this.containersToHide = element.querySelectorAll(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌 🙌 🙌 🙌

Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! 👏

@alex-ju alex-ju merged commit 0640264 into main Feb 9, 2024
16 checks passed
@alex-ju alex-ju deleted the alex-ju/sidenav-inert branch February 9, 2024 12:30
@hashibot-hds hashibot-hds mentioned this pull request Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants