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

a11y mobile toc #7850

Closed
wants to merge 0 commits into from
Closed

a11y mobile toc #7850

wants to merge 0 commits into from

Conversation

katiegoines
Copy link
Contributor

@katiegoines katiegoines commented Jul 25, 2024

Description of changes:

Implemented mobile TOC that functions like the mobile menu.

Before: on mobile, TOC content was at bottom
Screenshot 2024-07-31 at 12 57 23 PM

After: TOC content is in collapsible menu that functions like the main nav
Screenshot 2024-07-31 at 12 56 44 PM
Screenshot 2024-07-31 at 12 56 52 PM

Staging: https://a11y-mobile-toc.d1egzztxsxq9xz.amplifyapp.com/react/start/quickstart/#1-create-the-repository

Related GitHub issue #, if available:

Instructions

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

  • Does this PR conform to the styleguide?

  • Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.

  • Are any files being deleted with this PR? If so, have the needed redirects been created?

  • Are all links in MDX files using the MDX link syntax rather than HTML link syntax?

    ref: MDX: [link](https://docs.amplify.aws/)
    HTML: <a href="https://docs.amplify.aws/">link</a>

When this PR is ready to merge, please check the box below

  • Ready to merge

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@katiegoines katiegoines changed the title A11y mobile toc a11y mobile toc Jul 31, 2024
@katiegoines katiegoines marked this pull request as ready for review July 31, 2024 19:59
@katiegoines katiegoines requested a review from a team as a code owner July 31, 2024 19:59
@katiegoines katiegoines enabled auto-merge (squash) August 2, 2024 17:27
jacoblogan
jacoblogan previously approved these changes Aug 2, 2024
Copy link
Contributor

@hbuchel hbuchel left a comment

Choose a reason for hiding this comment

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

Just tested the staging site and noticed a couple things:

jacoblogan
jacoblogan previously approved these changes Aug 7, 2024
@@ -148,7 +176,49 @@ export const LayoutHeader = ({
)}
</div>
</View>
{showTOC ? <TableOfContents headers={tocHeadings} /> : null}
Copy link
Contributor

@hbuchel hbuchel Aug 9, 2024

Choose a reason for hiding this comment

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

For the table of contents can we find a way to keep it where it is currently in the DOM? Putting it in the header makes it more difficult for keyboard navigators to get to on desktop, where as if it's still in the <main> element they can at least use the skip to main link

Copy link
Contributor

@hbuchel hbuchel left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @katiegoines I think we're getting closer; probably there should have been a little more direction scrutinized on this one on my part. Left some comments about a broken functionality and some other suggestions/questions inline.

Additionally, some layout questions (and feel free to pushback on any of this, or maybe we can follow up at another time, these aren't particularly crucial):

  • Is it too awkward with the layout/css to only have one table of contents markup in the DOM? If probably makes the existing slide out menu CSS a little less re-usable if we did that but was wondering your thoughts on it.
  • Would it be difficult to make the "mobile" table of contents drop in sooner? The table of contents flips to below the content at the 1360px mark which differs from the mobile menu (that moves to the mobile version at 1000px).

And a styling suggestion:

  • Can we pretty this up? Suggest dropping the border and margin, and increasing the padding when the table of contents is in this slide out drawer.
Screenshot 2024-08-12 at 12 11 16 PM

Before

Screenshot 2024-08-12 at 12 08 34 PM

After

Screenshot 2024-08-12 at 12 09 32 PM

@@ -148,7 +176,48 @@ export const LayoutHeader = ({
)}
</div>
</View>
{showTOC ? <div className=""></div> : null}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed anymore?

Suggested change
{showTOC ? <div className=""></div> : null}

@@ -49,6 +56,16 @@ export const LayoutHeader = ({
// For keyboard navigators, move focus back to menu button in header
menuButtonRef?.current?.focus();
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this isn't working correctly with these changes. When I test keyboard closing the menu, it now focuses the table of contents toggle instead of the menu toggle.

ref={tocButtonRef}
className="search-menu-toggle mobile-toggle"
>
<IconMenu aria-hidden="true" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We can use the IconTOC here.

auto-merge was automatically disabled October 25, 2024 17:14

Pull request was closed

Copy link

mergify bot commented Oct 25, 2024

⚠️ The sha of the head commit of this PR conflicts with #7900. Mergify cannot evaluate rules on this PR. ⚠️

@katiegoines katiegoines mentioned this pull request Oct 25, 2024
15 tasks
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.

3 participants