#6913·heroui

[BUG] - ScrollShadow fade mask paints a faint line at fractional device pixel ratios

Author: aosmcleodCreated Sep 26, 2026Updated Sep 28, 2026
Labelstype/bugP3pkg/styles

HeroUI Version

3.2.6 (@heroui/styles 3.2.6). Also present on v3 at 9d1f943.

Describe the bug

At fractional device pixel ratios (for example Windows display scaling at 125%, devicePixelRatio 1.25), the fade variant of ScrollShadow paints a faint 1px line of reduced opacity through its content. The line runs the full length of the component, --scroll-shadow-scrollbar-size (10px) above the bottom edge in horizontal orientation, and 10px from the right edge in vertical orientation.

Since #6598 the mask is made of two layers that split the box between them:

css
/* horizontal */
mask-size: 100% calc(100% - var(--scroll-shadow-scrollbar-size)), 100% var(--scroll-shadow-scrollbar-size);
/* vertical */
mask-size: calc(100% - var(--scroll-shadow-scrollbar-size)) 100%, var(--scroll-shadow-scrollbar-size) 100%;

When the boundary between the layers falls inside a device pixel (10px is 12.5 device pixels at 1.25), that row or column is only partly covered by each layer. Each layer is anti-aliased separately and the two partial coverages composite to less than full opacity (two half coverages give about 75%), so the background shows through the content along that line.

With the default visibility="auto", the scroll-driven rules always resolve a mask-image, even when nothing overflows, so the line is present on any fade ScrollShadow whose content contrasts with what is behind it. In my app it shows as a line under the labels of a segmented control placed inside a horizontal ScrollShadow. The same control outside it is clean.

Measured with Playwright against the built @heroui/styles CSS, light and dark themes, overflowing and non-overflowing, scrolled to start, middle and end:

  • DPR 1: no line.
  • DPR 1.25: a line in most positions, in both orientations.
  • DPR 1.5: a line when the component sits on a half pixel.

Workaround: setting --scroll-shadow-scrollbar-size: 0px collapses the mask to one layer and removes the line, but it also fades the scrollbar lane, which #6598 was added to avoid.

Your Example Website or App

Minimal standalone repro below (no dependencies). It uses the auto-mode fade rules from scroll-shadow.css written as plain CSS.

scroll-shadow-seam.html
xml
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>ScrollShadow mask seam</title>
    <style>
      body { margin: 0; padding: 24px; font: 14px system-ui, sans-serif; background: #fff; }
      .row { display: flex; gap: 24px; align-items: flex-start; margin-block: 12px 24px; }
      .block { background: #3f3f46; }

      @property --scroll-shadow-start-fade { syntax: "<length>"; inherits: false; initial-value: 0px; }
      @property --scroll-shadow-end-fade { syntax: "<length>"; inherits: false; initial-value: 0px; }
      @keyframes scroll-shadow-start-fade {
        from { --scroll-shadow-start-fade: 0px; }
        to { --scroll-shadow-start-fade: var(--scroll-shadow-size); }
      }
      @keyframes scroll-shadow-end-fade {
        from { --scroll-shadow-end-fade: var(--scroll-shadow-size); }
        to { --scroll-shadow-end-fade: 0px; }
      }

      .scroll-shadow {
        position: relative;
        scrollbar-width: thin;
        --scroll-shadow-size: 40px;
        --scroll-shadow-scrollbar-size: 10px;
        --scroll-shadow-offset: 0px;
        animation: scroll-shadow-start-fade linear both, scroll-shadow-end-fade linear both;
        animation-range:
          var(--scroll-shadow-offset) calc(var(--scroll-shadow-offset) + var(--scroll-shadow-size)),
          calc(100% - var(--scroll-shadow-size) - var(--scroll-shadow-offset)) calc(100% - var(--scroll-shadow-offset));
        mask-image: linear-gradient(var(--scroll-linear-gradient)), linear-gradient(#000, #000);
        mask-repeat: no-repeat;
      }
      .scroll-shadow.horizontal {
        overflow-x: auto;
        width: 320px;
        animation-timeline: scroll(self inline), scroll(self inline);
        --scroll-linear-gradient: 90deg, transparent 0, #000 var(--scroll-shadow-start-fade),
          #000 calc(100% - var(--scroll-shadow-end-fade)), transparent 100%;
        mask-position: left top, left bottom;
        mask-size: 100% calc(100% - var(--scroll-shadow-scrollbar-size)), 100% var(--scroll-shadow-scrollbar-size);
      }
      .scroll-shadow.vertical {
        overflow-y: auto;
        width: 200px;
        height: 200px;
        animation-timeline: scroll(self block), scroll(self block);
        --scroll-linear-gradient: 180deg, transparent 0, #000 var(--scroll-shadow-start-fade),
          #000 calc(100% - var(--scroll-shadow-end-fade)), transparent 100%;
        mask-position: left top, right top;
        mask-size: calc(100% - var(--scroll-shadow-scrollbar-size)) 100%, var(--scroll-shadow-scrollbar-size) 100%;
      }
    </style>
  </head>
  <body>
    <div>Horizontal: no overflow, overflowing</div>
    <div class="row">
      <div class="scroll-shadow horizontal"><div class="block" style="height: 48px"></div></div>
      <div class="scroll-shadow horizontal"><div class="block" style="height: 48px; width: 960px"></div></div>
    </div>
    <div>Vertical: no overflow, overflowing</div>
    <div class="row">
      <div class="scroll-shadow vertical"><div class="block" style="height: 200px"></div></div>
      <div class="scroll-shadow vertical"><div class="block" style="height: 600px"></div></div>
    </div>
  </body>
</html>

Steps to Reproduce the Bug or Issue

  1. Set Windows display scaling to 125%, or use Chrome DevTools device emulation with a device pixel ratio of 1.25.
  2. Open the repro above. Alternatively, open the ScrollShadow docs and give the horizontal "Orientation" demo a background, e.g. background: var(--accent) on its [data-slot="scroll-shadow"] element.
  3. Look about 10px above the bottom edge of the horizontal boxes and 10px from the right edge of the vertical boxes.

Whether the line appears depends on where the component lands on the device pixel grid, so moving it by a pixel can hide or show it.

Expected behavior

Content between the fades renders at full opacity. Instead there is a lighter 1px line through the content, 10px from the scrollbar edge.

Screenshots or Videos

Docs page (horizontal and vertical "Orientation" demos with background: var(--accent)), captured at devicePixelRatio 1.25 and enlarged 8x with nearest-neighbour scaling. "current" is the shipped CSS, "fixed" is the change I'll propose in a PR (the gradient layer covers the whole box, with the scrollbar-lane layer on top), "workaround" is --scroll-shadow-scrollbar-size: 0px.

Image

Native-resolution capture of the horizontal demo. The line pixels are rgb(66, 163, 249) on an rgb(4, 133, 247) background.

Image

Operating System Version

Windows 11, display scaling 125%

Browser

Chrome (reproduced with Chromium 153 through Playwright at deviceScaleFactor 1.25; other engines not tested)