WebAIM - Web Accessibility In Mind

E-mail List Archives

Thread: "Go to Top" element, link or button

for

Number of posts in this thread: 4 (In chronological order)

From: Rick
Date: Tue, Jan 17 2023 3:48PM
Subject: "Go to Top" element, link or button
No previous message | Next message →

I am having a debate with our internal web development team regarding a "go
to top" element on our websites. I was recently reviewing one of our
internal websites that is nicely sectioned in the main region / landmark. At
the end of each section is a button labeled "go to top," which moves the
focus to the beginning of the main region / landmark. This is also what is
published in our web development guidelines. The debate is whether this
element should be a button or a link. I have my opinion, but I do not want
to influence yours.



Should this be a button or a link. Please let me know your opinion and why
you have that opinion. Afterwards, I will provide mine.



Rick

From: Glen Walker
Date: Tue, Jan 17 2023 4:52PM
Subject: Re: "Go to Top" element, link or button
← Previous message | Next message →

Links are for navigating, whether to a new page or a different location on the same page, so it sounds like you should have a link.

If the user can use the browser's “back“ button and navigate back to where they were before they selected the “go to top” element , then that's another argument that it should be a link.

But I can understand if someone argues for a button since this feels like an immediate action.

For me, it comes down to how it's implemented. If you make it a button and then you programmatically move the focus to the top of the section, then the user can't use the browser's back button and it would be OK to be a button instead of a link.

My first choice would be a link and use the browser's built-in functionality to move the focus for you. But I wouldn't fail WCAG if a button was used and implemented as mentioned above.

From: Srinivasu Chakravarthula
Date: Tue, Jan 17 2023 10:53PM
Subject: Re: "Go to Top" element, link or button
← Previous message | Next message →

Historically, we use "link" for Skip elements and "back to top" does
similar job hence it can be a link too and not a button.
Regards,

Srinivasu Chakravarthula, CPWA
Website <http://www.srinivasu.org>; | LinkedIn Profile
<http://linkedin.com/in/srinivasuc>; | Follow me on Twitter
<http://twitter.com/csrinivasu>;
Director of Accessibility, Freshworks


On Wed, Jan 18, 2023 at 5:22 AM Glen Walker < = EMAIL ADDRESS REMOVED = > wrote:

> Links are for navigating, whether to a new page or a different location on
> the same page, so it sounds like you should have a link.
>
> If the user can use the browser's “back“ button and navigate back to where
> they were before they selected the “go to top” element , then that's
> another argument that it should be a link.
>
> But I can understand if someone argues for a button since this feels like
> an immediate action.
>
> For me, it comes down to how it's implemented. If you make it a button and
> then you programmatically move the focus to the top of the section, then
> the user can't use the browser's back button and it would be OK to be a
> button instead of a link.
>
> My first choice would be a link and use the browser's built-in
> functionality to move the focus for you. But I wouldn't fail WCAG if a
> button was used and implemented as mentioned above.
> > > > >

From: Clayton Silva
Date: Thu, Jan 19 2023 5:45PM
Subject: Re: "Go to Top" element, link or button
← Previous message | No next message

Here is my old-school top of mind response:

Use links when the context is traversing to another place. Use buttons when the context is an action or process. It isn't a hard rule, but be accessible and be consistent in any use. Also, we overdid these "back to top" links eons ago--less is more now. People are more willing to scroll and have better tools to do so versus long ago. Use them only when they are really needed.

Just my quick take that they should be links, not buttons in most cases.

Clayton Silva
California Department of Education