Content-Length: 763453 | pFad | http://github.com/nodejs/nodejs.org/pull/7390

CC init: add skip-to-main-content shortcut by yaten2302 · Pull Request #7390 · nodejs/nodejs.org · GitHub
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

init: add skip-to-main-content shortcut #7390

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

yaten2302
Copy link

Description

This PR adds a skip to main content button (initially hidden), when the user presses Tab(for windows), the button is visible and the user can then move directly to the main content of the page.

Related Issues

Fixes #7220

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run format to ensure the code follows the style guide.
  • I have run npm run test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
@yaten2302 yaten2302 requested a review from a team as a code owner January 7, 2025 06:57
Copy link

vercel bot commented Jan 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Jan 24, 2025 3:12pm

@yaten2302
Copy link
Author

yaten2302 commented Jan 7, 2025

I think currently on pressing Tab, the button is shown, but it's not getting pressed if the user presses Enter, I forgot take into account the Enter button, I'll push a commit for this too 👍

Edit: Sorry, will not ping 👍

@AugustinMauroy
Copy link
Member

WOW stop pinging everyone ! we (website team) receive notification when there are changes on repo.

apps/site/components/withNavBar.tsx Show resolved Hide resolved
apps/site/components/withNavBar.tsx Outdated Show resolved Hide resolved
apps/site/components/withNavBar.tsx Outdated Show resolved Hide resolved
Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
apps/site/components/withNavBar.tsx Outdated Show resolved Hide resolved
Signed-off-by: Yaten Dhingra <yaten598@gmail.com>

const toggleCurrentTheme = () =>
setTheme(resolvedTheme === 'dark' ? 'light' : 'dark');

return (
<div>
<a className={classNameOnTabPress} href="#main">
Copy link
Member

Choose a reason for hiding this comment

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

Anchor href is not working, main element is missing the id attribute.

Copy link
Author

Choose a reason for hiding this comment

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

This href won't work as of now, because I just set it randomly to #main, I wanted to clarify that to what section the user must be directed to on clicking this button?

Copy link
Member

Choose a reason for hiding this comment

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

I believe It should redirect to main indeed

Copy link
Author

Choose a reason for hiding this comment

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

For this, is there a main class present in the pages? Ig not?
There is this <main/> tag present in the about page, just for example.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I don't understand what you saying

Copy link
Author

Choose a reason for hiding this comment

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

I was trying to say that on any page, since we're redirecting to #main, there is no such class as #main on any page, so where should the user be redirected?

Copy link
Member

Choose a reason for hiding this comment

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

User should be "redirected" to main, layouts lives on apps/site/layouts.

apps/site/components/withNavBar.tsx Outdated Show resolved Hide resolved
Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
@yaten2302
Copy link
Author

I've pushed a minor change(typo). Just wanted to ask, that could anyone please guide regarding these points, I was having a few doubts:

  1. What should be the bg color?
  2. init: add skip-to-main-content shortcut #7390 (comment)

Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
@yaten2302
Copy link
Author

Hi, I've pushed a commit, and I think that this addresses all the changes mentioned and required! Could anyone please have a look at it and LMK if any change has to be made in this?

@yaten2302
Copy link
Author

Hey, can anyone please have a look and LMK if any more changes are required?

@AugustinMauroy
Copy link
Member

AugustinMauroy commented Jan 19, 2025

Capture d’écran 2025-01-19 à 15 53 57

I don't really know what to do with this button, but at the moment it degrades the UI.

Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
@aduh95
Copy link
Contributor

aduh95 commented Jan 22, 2025

I've tried to pull that PR on top of main and run npm run dev but couldn't get the button to show up, am I missing something?

@yaten2302
Copy link
Author

2025-01-23.11-09-38.mp4

I've shared a screen recording for the same, is this behavior not being shown on your side? I just checked that in the deployment also it's showing this.

@aduh95
Copy link
Contributor

aduh95 commented Jan 23, 2025

No even running from the DevTools Array.from(document.all).find(a => a.textContent.trim() === 'Skip to content') returns undefined 🤔

My steps are:

git fetch https://github.com/nodejs/nodejs.org.git HEAD
git reset FETCH_HEAD --hard
curl -L https://github.com/nodejs/nodejs.org/pull/7390.patch | git am
npm ci
npm run dev

@yaten2302
Copy link
Author

I used deployment dev tools:
image

@@ -19,6 +21,7 @@ const layouts = {
'blog-category': BlogLayout,
download: DownloadLayout,
article: ArticlePageLayout,
skipToContent: WithNavBar,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think skipToContent is a page layout, IMO it is a feature in layouts

Copy link
Author

Choose a reason for hiding this comment

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

Someone mentioned about this in previous suggestions, that it needs to be added in withLayout.tsx, should I remove this?

Copy link
Member

Choose a reason for hiding this comment

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

I think you are talking about this comment; #7390 (comment)

@araujogui As far as I understand, the suggestion is to move the skip to content button here, not add it as a layout right? 🤔

Copy link
Author

Choose a reason for hiding this comment

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

Yes, saying about this 👍

apps/site/components/withNavBar.tsx Outdated Show resolved Hide resolved
apps/site/components/withNavBar.tsx Outdated Show resolved Hide resolved
@@ -6,4 +6,5 @@ export type Layouts =
| 'blog-category'
| 'blog-post'
| 'download'
| 'article';
| 'article'
| 'skipToContent';
Copy link
Member

Choose a reason for hiding this comment

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

Similarly, IMO there should be no skip to content layout

@canerakdas canerakdas mentioned this pull request Jan 24, 2025
5 tasks
Signed-off-by: Yaten Dhingra <yaten598@gmail.com>
@aduh95
Copy link
Contributor

aduh95 commented Jan 24, 2025

It looks like we don't have any element with a main id, so the button is moot.

I've also tried to use the website using VoiceOver, it seems completely impossible to access the menu from there, which is pretty bad, but I guess I'll open a separate issue for that.

@yaten2302
Copy link
Author

Yes, I think, the desired behavior is such that on clicking skip to content button, the user should be redirected to the section with id - #main, right?
And I think it's not present as of now, so once all the ID's are added, then it would be helpful, am I right?

@aduh95
Copy link
Contributor

aduh95 commented Jan 24, 2025

As you can read in https://www.w3.org/TR/WCAG20-TECHS/G1.html#G1-tests, in order to fix the linked issue the following checks need to pass:

[…]
4. Check that activating the link moves the focus to the main content.
5. Check that after activating the link, the keyboard focus has moved to the main content.

Currently those check fail; adding the ids might fix that yes

@yaten2302
Copy link
Author

May I create an issue for the same?
Something like - Add #main id to navigate to main section of pages?

@yaten2302
Copy link
Author

By the time this issue gets fixed, I would like to work upon some other issues too! And this PR can be kept on hold for a while till the time the main id is added in all pages.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

I'd ask to first apply the suggestions made from other users. I appreciate that you're iterating over our feedback and appreciate your time here.

Having that said, I don't think this can land as it is right now. The button is simply hiding other content and overlapping with it in a non-productive manner.

I'd recommend using the small variant of our Button, and making it floating on the bottom right (position: fixed) or something of sort.

That said, I don't really think our pages need a "skip to content" Button -- Our pages are already designed in a way that the content is always already present even when scroll is zeroed. It is a very responsive design and that does not require a button to skip to content, since again, the content is always visible.

I'm -1 on this change.

@aduh95
Copy link
Contributor

aduh95 commented Jan 26, 2025

For example the download page could definitely benefit form it, it takes a long while to get to the download button using VoiceOver – but that could be solved by adding a low tabindex attribute to the download button(s) EDIT: I was wrong, messing with tabindex is listed as an anti-pattern

@ovflowd
Copy link
Member

ovflowd commented Jan 26, 2025

For example the download page could definitely benefit form it, it takes a long while to get to the download button using VoiceOver – but that could be solved by adding a low tabindex attribute to the download button(s).

Which download page? The download page renders all in one screen without even needing to scroll

@ovflowd
Copy link
Member

ovflowd commented Jan 26, 2025

Also the whole downloads page is the main content; A skip to main content there just does not make any sense here.

@aduh95
Copy link
Contributor

aduh95 commented Jan 26, 2025

For example the download page could definitely benefit form it, it takes a long while to get to the download button using VoiceOver – but that could be solved by adding a low tabindex attribute to the download button(s).

Which download page? The download page renders all in one screen without even needing to scroll

VoiceOver is a screen reader built into Apple OSes (macOS, iOS, tvOS, watchOS, iPadOS) designed to increase accessibility for blind and low-vision users, as well as for users with dyslexia. The fact that all the content is visible without scrolling is irrelevant for folks who can't see

@ovflowd
Copy link
Member

ovflowd commented Jan 26, 2025

For example the download page could definitely benefit form it, it takes a long while to get to the download button using VoiceOver – but that could be solved by adding a low tabindex attribute to the download button(s).

Which download page? The download page renders all in one screen without even needing to scroll

VoiceOver is a screen reader built into Apple OSes (macOS, iOS, tvOS, watchOS, iPadOS) designed to increase accessibility for blind and low-vision users, as well as for users with dyslexia. The fact that all the content is visible without scrolling is irrelevant for folks who can't see

Are we talking about the same thing? I'm talking about a skip to content button. That doesn't make sense to be rendered nor added. We can detect by CSS queries if the user is using a VoiceOver tool, in those situations if you believe any extra accessibility accessory needs to be added here, I'd like to follow standards proposed by a11y.

@aduh95
Copy link
Contributor

aduh95 commented Jan 26, 2025

As you can read in #7220 description (or directly in https://www.w3.org/TR/WCAG20-TECHS/G1.html#G1-tests), the "Skip to content" button is an a11y best practice. Anyway, your point of "we may actually not need it" is not invalid, I'm not disputing it – though I'd encourage you to try browsing the Download page with a screen reader, getting to the important links takes a frustrating long time.

@ovflowd
Copy link
Member

ovflowd commented Jan 26, 2025

As you can read in #7220 description (or directly in w3.org/TR/WCAG20-TECHS/G1.html#G1-tests), the "Skip to content" button is an a11y best practice. Anyway, your point of "we may actually not need it" is not invalid, I'm not disputing it – though I'd encourage you to try browsing the Download page with a screen reader, getting to the important links takes a frustrating long time.

Noted. I believe this is something tricky. I would consider closing this PR and open an discussion first so we can properly discuss about how to approach this. Maybe for key/essential pages we can have invisible elements that are rendered for screen readers, that's also a common practice.

@yaten2302
Copy link
Author

Should I close this PR for now? Maybe after some discussion, a new PR can be created?

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.

Adding a "Skip to Content" Link
6 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/nodejs/nodejs.org/pull/7390

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy