Give focus on the element after scrolling to it

Created on 31 March 2022, about 2 years ago
Updated 18 June 2024, 10 days ago

Problem/Motivation

Give focus on the element after scroling to it. This allows to be RGAA compliant. We must give the focus on the element targeted once we have scrolled to it.

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France flocondetoile Lyon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇮Finland Aelfendir

    You should be able to work around this issue by disabling the "Smooth scrolling" setting.

    If you want to retain the smooth scrolling effect, you could apply that with CSS:

    @media (prefers-reduced-motion: no-preference) {
      html {
        scroll-behavior: smooth;
      }
    }
  • 🇫🇷France mably

    Just released the ToC NG → module which is a fork of this module (ToC.js).

    This module was developed as a proof-of-concept for our own needs. We decided to share it with the community.

    There is a new option allowing to set the focus on the targeted heading after scroll:

Production build 0.69.0 2024