Skip to content

bind:clientWidth does not update when scrollBar appears/disappears #17457

@CrumbsTrace

Description

@CrumbsTrace

Describe the bug

Svelte internally uses a border-box ResizeObserver for bindings to clientWidth. Since the border-box size does not change when a scrollbar appears due to overflow, the clientWidth binding is never updated even when it should be.
Same issue would occur for clientHeight and a horizontal scrollbar.

Reproduction

https://svelte.dev/playground/0939f434e88d4fc7bda693b2a9ab78f5?version=5.46.1

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 13th Gen Intel(R) Core(TM) i5-1345U
    Memory: 14.52 GB / 31.66 GB
  Binaries:
    Node: 24.11.1 - C:\Program Files\nodejs\node.EXE
    npm: 11.7.0 - C:\ProgramData\npm\npm\npm.CMD
    bun: 1.2.18 - C:\Users\vkalkman\.bun\bin\bun.EXE
  Browsers:
    Chrome: 143.0.7499.193
    Edge: Chromium (140.0.3485.54)
    Firefox: 146.0.1 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.22621.3527

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions