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 Screen reader is not announcing the index numbers for the items in V2 dropdown #23613

Merged
merged 9 commits into from
Jan 23, 2025

Conversation

RishhiB
Copy link
Contributor

@RishhiB RishhiB commented Jan 21, 2025

Fix Screen reader is not announcing the index numbers for the items in V2 dropdown

How to test

  • Enable VoiceOver for mac, cmd + F5, or Narrator for windows
  • Open the link Fluid Framework Documentation | Fluid Framework
  • Tab till V2 dropdown in header.
  • Hit enter.
  • Using down arrow key navigate to the items in dropdown.
  • Observe that Screen reader is not announcing the index numbers for the items in V2 dropdown.

@Copilot Copilot bot review requested due to automatic review settings January 21, 2025 18:51

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

docs/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx:72

  • Ensure that version.label is properly sanitized before using it in the aria-label to avoid potential issues with screen readers.
"aria-label": `Version ${version.label}, item ${index + 1} of ${versions.length}`,

docs/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx:68

  • [nitpick] Consider using aria-label instead of label for accessibility purposes to maintain consistency.
"label": version.label,
@github-actions github-actions bot added the base: main PRs targeted against main branch label Jan 21, 2025
*/
function getVersionMainDoc(version: GlobalVersion): GlobalDoc {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return version.docs.find((doc) => doc.id === version.mainDocId)!;
Copy link
Contributor

@jikim-msft jikim-msft Jan 22, 2025

Choose a reason for hiding this comment

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

The main doc should always exist right? Should we actually consider adding an assertion here?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good point. We should explicitly mention the expected behavior in edge cases, such as when no main doc is found

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What method of assertion would you prefer? I used the non-null assertion, we could use another method. should I assign it to a variable and assert if that variable is not unefined?

Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  170508 links
    1603 destination URLs
    1842 URLs ignored
       0 warnings
       0 errors


@RishhiB
Copy link
Contributor Author

RishhiB commented Jan 23, 2025

Thank you @jikim-msft!

@RishhiB RishhiB merged commit 90ff293 into microsoft:main Jan 23, 2025
29 checks passed

/**
* Wraps the default DocsVersionDropdownNavbarItem to omit the drop-down on non-versioned pages.
* This module provides a custom implementation of the DropdownNavbarItem to enhance accessibility of the dropdown menu for navigation between doc versions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this isn't a module, it's a function.

* @remarks
* Suggested workaround for lack of version dropdown customization.
* See {@link https://github.com/facebook/docusaurus/issues/4389}.
* Context:
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: since this isn't part of the semantic description of the function, it really belongs under the @remarks block.

*/
function getVersionMainDoc(version: GlobalVersion): GlobalDoc {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a non-null assertion on the next line. Is this needed?

@RishhiB RishhiB deleted the bug26840 branch January 27, 2025 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: website base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants