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

chore: add 'Skip to main content' button to the main page #1837

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

Conversation

ToMESSKa
Copy link
Contributor

@ToMESSKa ToMESSKa commented Dec 20, 2024

Closes: INSTUI-4240

ISUUE: main page does not have a a 'Skip to main content' button to avoid going through repetitive content. This current implementation is based on this recommendation: https://www.a11y-collective.com/blog/skip-to-main-content/

TEST PLAN:
test skipt to main button:

  • go through the different types of docs page with screenreader with Tab
    1. main page
    2. document like /#Alert or /#focus-management
    3. changelog page /#CHANGELOG
    4. theme page like /#canvas-high-contrast
    5. icons page: /#icons
    6. error page /#iconsss

  • the first focusable element on each page should be a 'Skip to main content' button

  • the button should not be visible when not focused

  • when the button is clicked, it should bring the focus to the main content

  • the 'Skip to main content' button also should work when the side navigation is open

test skip to main button focus after page load:

  • click a link from the navigation bar like Alert, Icons, canvas-high-contrast, Focus Management etc
  • after page loads, nothing should be focused and the first tabbable element should be the 'Skip to main content' button

test clicking the hamburger Icon:

  • click the hamburger icon
  • the focus should be jumped to the search bar inside of the navigation

@ToMESSKa ToMESSKa self-assigned this Dec 20, 2024
Copy link

github-actions bot commented Dec 20, 2024

PR Preview Action v1.6.0

🚀 View preview at
https://instructure.github.io/instructure-ui/pr-preview/pr-1837/

Built to branch gh-pages at 2025-01-28 08:44 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@ToMESSKa ToMESSKa force-pushed the INSTUI-4240_docs_add_skip_to_main_content_button branch from 7ba47f3 to ec9fd33 Compare December 20, 2024 10:33
@ToMESSKa ToMESSKa requested review from matyasf and HerrTopi December 20, 2024 10: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.

While it works good on the main page, it breaks on other pages. I think the good solution is to focus on the content container, it does not have to be an interactive element.
This is done by e.g. wikipedia.com or github.com

@ToMESSKa ToMESSKa force-pushed the INSTUI-4240_docs_add_skip_to_main_content_button branch from ec9fd33 to a7e2315 Compare January 8, 2025 14:50
@ToMESSKa
Copy link
Contributor Author

ToMESSKa commented Jan 8, 2025

While it works good on the main page, it breaks on other pages. I think the good solution is to focus on the content container, it does not have to be an interactive element. This is done by e.g. wikipedia.com or github.com

I fixed the above issues:

  • now the focus should go to the container containing the main content
  • the skip to Main button should also work the same way on the doc type pages (like Alert or API Guidelines) but was not implemented on the rest (like Icons or Changelog), I think it had no point to use this button on those pages

@ToMESSKa ToMESSKa requested a review from matyasf January 8, 2025 15:12
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.

still not perfect, I could not trigger it when the side nav is open. Also AFAIK it should work for ALL pages, the main purpose of this feature is that if I send you a link like https://instructure.design/pr-preview/pr-1837/#CHANGELOG and you are a keyboard only SR user you dont have to tab trough our whole menu. Also its not nice to have a button that does nothing in this case. Cant you just move the focus to the content container?

@ToMESSKa ToMESSKa force-pushed the INSTUI-4240_docs_add_skip_to_main_content_button branch from a7e2315 to 7f7122f Compare January 23, 2025 13:25
@ToMESSKa
Copy link
Contributor Author

still not perfect, I could not trigger it when the side nav is open. Also AFAIK it should work for ALL pages, the main purpose of this feature is that if I send you a link like https://instructure.design/pr-preview/pr-1837/#CHANGELOG and you are a keyboard only SR user you dont have to tab trough our whole menu. Also its not nice to have a button that does nothing in this case. Cant you just move the focus to the content container?

@matyasf I addressed this issue. Now the 'Skip to main button' should work on every page and also when the nav bar is open. Also added focus to Search bar inside of the navigation when open. Please check the revised test plan.

@ToMESSKa ToMESSKa requested a review from matyasf January 23, 2025 13:29
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.

nice work, works perfectly now :)

PS: The preview link is not up to date, I guess because of the merge conflict?

Closes: INSTUI-4240
chore: add 'Skip to main content' button to the main page
@ToMESSKa ToMESSKa force-pushed the INSTUI-4240_docs_add_skip_to_main_content_button branch from 7f7122f to 87a856f Compare January 28, 2025 08:39
@ToMESSKa
Copy link
Contributor Author

nice work, works perfectly now :)

PS: The preview link is not up to date, I guess because of the merge conflict?

@matyasf I resolved the merge conflict, the preview link seems up-to-date to me now.

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