Skip to content

Implement accessible smooth scrolling for internal anchor links in Frontblocks. #219

Description

@Castellon-ACM

Context

Frontblocks should support smooth scrolling for same-page anchor links, especially for landing pages, documentation pages, and block-based layouts.

The implementation should follow accessibility best practices described here:

https://css-tricks.com/smooth-scrolling-accessibility/

Requirements

  • Add smooth scrolling for same-page anchor links.
  • Only target valid internal hash links.
  • Ignore external links.
  • Ignore empty hashes such as # and #0.
  • Respect prefers-reduced-motion.
  • Ensure keyboard focus moves to the target element after scrolling.
  • If the target element is not naturally focusable, temporarily add tabindex="-1" before focusing it.
  • Preserve or update the URL hash correctly.
  • Avoid issues with sticky headers.
  • Keep the implementation lightweight and dependency-free.

Suggested approach

Use native CSS when possible:

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions