Skip to content

Update aria roles on mzp navigation #860

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

Merged
merged 3 commits into from
May 11, 2023
Merged

Update aria roles on mzp navigation #860

merged 3 commits into from
May 11, 2023

Conversation

nathan-barrett
Copy link
Contributor

Description

Moves the aria-expanded attribute to the mzp-c-navigation-menu-button instead of the menu items as explained in #847. Also removes the aria-expanded attribute on desktop since the element is not displayed, so firefox no longer includes it in the accessibility tree.

Issue

#847

Testing

You can test this by running a local server and navigating to this page: http://localhost:3000/components/preview/navigation--default and using the inspector to view the element and make sure that the aria-expanded role is toggling correctly.

@nathan-barrett nathan-barrett added Needs:Review 👋 Ready for Developer Review A11y ♿️ Accessibility issues labels Mar 14, 2023
@nathan-barrett
Copy link
Contributor Author

Added a feature detection check to support IE and older browsers - the method that I decided to use, intersectionRatio seems to be the most well supported.

Navigation.setAria();
}
};

/**
* Initialise menu.
* Initialize menu.
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 Author

Choose a reason for hiding this comment

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

is it! oops - it just showed up on the spell checker 😿

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I just meant to tease for the change from 🇨🇦 to 🇺🇸 . It's a good change.

Copy link
Contributor

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

Sorry this took me a while to get round to looking at. It looks good! I like the idea of using IntersectionObserver for things like this 👍

A few small issues / fix-ups below, but it works well for me :)

@nathan-barrett
Copy link
Contributor Author

Thanks @alexgibson - thought InteractionObserver was the best way to detect the change in CSS when an element is going from display:none to being displayed on a page.

@nathan-barrett nathan-barrett force-pushed the 847-aria-expanded-nav branch from bb71325 to f8bcd1c Compare May 4, 2023 22:12
@nathan-barrett nathan-barrett requested a review from alexgibson May 4, 2023 22:14
Copy link
Contributor

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

Suggested fixes look good, but I'm not sure if the new code is triggering? It seems to be falling back to the else clause (because the feature detect is named slightly differently I think).

Also, let's make sure we update the changelog for this bug fix before we merge! 👍

alexgibson added a commit that referenced this pull request May 9, 2023
@alexgibson
Copy link
Contributor

There were some fairly big changes that landed in #867, so to (hopefully) make things easier I took a go at rebasing your branch here. I opened a new PR, to make viewing the changes easier. I didn't change or update anything, so probably best check I didn't miss anything?

Feel free to use my commit / branch below in whatever way works best here:

#873

@nathan-barrett nathan-barrett force-pushed the 847-aria-expanded-nav branch from f8bcd1c to 3ac4b6b Compare May 9, 2023 16:36
@nathan-barrett nathan-barrett requested a review from alexgibson May 9, 2023 16:36
@nathan-barrett
Copy link
Contributor Author

@alexgibson Thanks for making the PR! It was helpful as I was going through the rebase - I made sure that I was using the right MzpSupports check 🤦🏻 - let me know if you see anything that should be flagged

Copy link
Contributor

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

This needs a rebase, but aside from a couple of minor nits / suggestions the updates look good r+wc 👍

@nathan-barrett nathan-barrett force-pushed the 847-aria-expanded-nav branch from d44a634 to c050a12 Compare May 10, 2023 16:35
@nathan-barrett nathan-barrett requested a review from alexgibson May 10, 2023 16:35
Copy link
Contributor

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

r+!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A11y ♿️ Accessibility issues Needs:Review 👋 Ready for Developer Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants