Skip to content

useRect: scrollTop/scrollLeft accumulate past the wrapper boundary to document root #17

Description

@arzafran

Summary

useRect's internal scrollTop / scrollLeft helpers (packages/hamo/src/use-rect/utils.ts) walk up the ancestor chain accumulating scroll offset past the intended wrapper boundary, all the way to the document root. This is flagged in #12 as a deliberate "known follow-up (not in this PR)":

useRect's scrollTop/scrollLeft helpers accumulate scroll past the intended wrapper boundary up to the document root. Left as-is pending a coordinate-space decision — it's tested behavior and changing it blindly is riskier than the cleanup is worth.

Filing as a tracking issue so the decision isn't lost once the v1 PR (#12) merges and its description is buried.

Why it's deferred, not fixed

The current behavior is covered by tests, and the "correct" coordinate space depends on intended usage (wrapper-relative vs document-relative). Changing it blindly risks regressing consumers who rely on the current accumulation.

Decision needed

  • Define the intended coordinate space for useRect offsets (stop at the configured wrapper vs. continue to root).
  • If wrapper-relative is correct, bound the traversal at the wrapper and update the tests to lock the intended semantics.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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