Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

60
Views
Accessibility issue on scroll

$("#onReviewClick").click(function()
{ $('html, body').animate({
scrollTop: ($("#scrollHere").offset().top)-100 },
1000); });

I have a text read more, this onclick scrolls down to the footer part of the page and focus on the reviews. I want the screen reader to read the reviews when the scroll moves down to the review part.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I'd use the animate callback function to run your code after the animation has completed.

Then I believe you add the aria-live="polite" attribute to the element you want your screen reader to speak.

$("#onReviewClick").click(function() {
  $('html, body').animate({
    scrollTop: ($("#scrollHere").offset().top) - 100
  }, 1000, function() {
    // Animation complete.
    $("#scrollHere").attr('aria-live', 'polite');
  });
});
about 4 years ago · Juan Pablo Isaza Report

0

The simplest and safest way to scroll the screen and make the screen reader to go read at the correct place is to use good old anchors as the base:

<a href="#more">More</a>
.
.
.
<p id="more">More text</p>

Slightly less simple and safe, but still very well working, is to immediately put the focus at an element naturally focusable or made focusable with tabindex=-1:

<a href="#" onclick="document.getElementById('more').focus();">More</a>
.
.
.
<p id="more" tabindex="-1">More text</p>

I emphasize about the word immediately because moving the focus outside of an immediate interaction can sometimes cause problems. It may be totally ignored, or make the screen reader to jump in another place in between and then don't follow the second focus change a few milliseconds later. So, doing it at the end of an animation, even if it's only a few dozends of milliseconds, can cause problems.

This answer won't make designers happy, but ideally, you should take the ancohr or immediate focus pattern as a base, and then build your animation on top of that if you can, rather than the opposite. Accessibility speaking, it's going to be much more robust. By the way, note that the user can have configured his device to disable animations or reduce them, and you should take that into account, too.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!