Skip to content

A platform for community discussion. Free, open, simple.

1.2 KB
Raw Blame
.d-virtual-list {
  /* This element is the scroll viewport the virtualizer measures and drives. Its
     height belongs to the consumer: a zero-height element yields an empty window
     and silently renders nothing. Box spacing here would offset the engine's
     measured total from the DOM scroll height permanently, so put padding and
     borders on a wrapper or on the rows.

     Vertical only: rows are absolutely positioned and stretched across the inline
     axis, so they offer no intrinsic width for an inline scrollbar to act on.
     Content wider than the viewport has to scroll inside its own row. */
  overflow: hidden auto;
  overscroll-behavior: contain;

  /* Rows are absolutely positioned to approximate offsets, so the browser must not
     pick the list as a scroll anchor — its correction would fight the virtualizer's
     own scroll compensation and produce a jump. */
  overflow-anchor: none;

  &__sizer {
    margin: 0;
    padding: 0;

    /* Removing the marker also removes the implicit list semantics in some
       screen readers, so only do it once the element is carrying an explicit
       role of its own. */

    &[role] {
      list-style: none;
    }
  }
}