This is the version used on this site. It offers many options and may not be for everyone.

You will need to add this to your global CSS to enable the progress bar.

/* MUST be global for reliable animation of a custom property */
@property --fw-progress {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0turn;
}

/* Your existing keyframes can remain global */
@keyframes fw-scroll-progress {
  from { --fw-progress: 0turn; }
  to   { --fw-progress: 1turn; }
}

  /* Top-level @supports (no nesting). This is the one that actually works. */
  @supports (animation-timeline: scroll(root)) {
    .fw-scroll-to-top[data-fw-use-progress='true'][data-fw-progress-mode='css-timeline']::before {
      animation: fw-scroll-progress linear both;
      animation-timeline: scroll(root);
    }
  }

  /* Optional: if your browser only recognizes scroll() without args */
  @supports (animation-timeline: scroll()) {
    .fw-scroll-to-top[data-fw-use-progress='true'][data-fw-progress-mode='css-timeline']::before {
      animation: fw-scroll-progress linear both;
      animation-timeline: scroll();
    }
  }
image
A wide variety of settings