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

fix(ui-breadcrumb): add and update aria tags in Breadcrumb and documentation #1788

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ToMESSKa
Copy link
Contributor

@ToMESSKa ToMESSKa commented Nov 22, 2024

Closes: INSTUI-4268

ISSUES:

TEST PLAN:

- test the new isCurrentPage prop on the examples in the documentation
- the last element of the right should now have an aria-current="page" attribute in HTML, if isCurrentPage prop isn't set to true on any other crumb
- if isCurrentPage is set to an element, which not is the last one, that element should have aria-current="page" attribute now
- screenreaders should annouce the element with the aria-current="page" attirubute as the current
- the examples in the breadcrumb should have descriptive aria-labels ("breadcrumb" instead of "you are here")
- review the modified documentation and the new tests

@ToMESSKa ToMESSKa self-assigned this Nov 22, 2024
Copy link

github-actions bot commented Nov 22, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://instructure.github.io/instructure-ui/pr-preview/pr-1788/
on branch gh-pages at 2024-12-19 11:29 UTC

@ToMESSKa ToMESSKa requested a review from matyasf November 22, 2024 15:53
Copy link
Collaborator

@matyasf matyasf left a comment

Choose a reason for hiding this comment

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

See my comment. Also please write in the Readme in the DO section that the current location should always be the last element in the breadcrumb, this is not stated in the page explicitly

return (
<li css={styles?.crumb} style={inlineStyle}>
{child}
{isLastElement && hasHref ? this.addAriaCurrent(child) : child}
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I understand we can always put this ARIA tag here.
From https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current "If the element representing the current page in the breadcrumb was not a link, the aria-current is optional.", lets put it always there. same in mdn's example: https://developer.mozilla.org/en-US/docs/Web/CSS/Layout_cookbook/Breadcrumb_Navigation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ToMESSKa ToMESSKa force-pushed the INSTUI-4268_bread_crumb_needs_special_aria_tags_and_wrapped_in_nav branch from 41581c3 to d440ccd Compare December 11, 2024 13:29
@ToMESSKa
Copy link
Contributor Author

See my comment. Also please write in the Readme in the DO section that the current location should always be the last element in the breadcrumb, this is not stated in the page explicitly

as now users can set the aria-current themselves, I don't think it's relevant anymore

@ToMESSKa ToMESSKa changed the title fix(ui-breadcrumb): add and update aria tags in Breadcrumb fix(ui-breadcrumb): add and update aria tags in Breadcrumb and documentation Dec 11, 2024
@matyasf matyasf marked this pull request as ready for review December 13, 2024 15:21
* Whether the page this breadcrumb points to is the current one. If true, it sets aria-current="page".
* If this prop is not set to true on any breadcrumb, the element recieving the aria-current="page" will always be the last element on the right by default, unless the last last element's isCurrentPage prop is explicity set to false too.
*/
isCurrentPage?: boolean
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please make an a11y page to the docs, like in https://instructure.design/#Alert where you write how and when this prop should be used

Copy link
Collaborator

Choose a reason for hiding this comment

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

"on the right by default" this is not needed, for RTL languages its different

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the a11y box and removed the "on the right by default" part

@ToMESSKa ToMESSKa force-pushed the INSTUI-4268_bread_crumb_needs_special_aria_tags_and_wrapped_in_nav branch from d440ccd to 99fae9c Compare December 19, 2024 11:23
@ToMESSKa ToMESSKa requested a review from matyasf December 19, 2024 11:31
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

Successfully merging this pull request may close these issues.

2 participants