Skip to content

Incorrect offset calculation for elements positioned with transform: translate() in scrollIntoView #7716

Description

@piecyk

Provide a general summary of the issue here

Incorrect offset calculation when child elements are positioned with transform: translateY() or translateX().

🤔 Expected Behavior?

The function should return the correct offset even when the child element is positioned using CSS transform: translateY() or translateX().

😯 Current Behavior

The current function only considers offsetTop and offsetLeft, which do not account for elements transformed using translateY() or translateX(). This results in incorrect positioning calculations.

💁 Possible Solution

Use getBoundingClientRect() to calculate the relative offset instead of relying on offsetTop and offsetLeft.

🔦 Context

No response

🖥️ Steps to Reproduce

  1. Create an element inside an ancestor with transform: translateY(100px);
  2. Use the current function to compute its relative offset
  3. Observe that the function does not account for the transformed position

Version

latest

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macos

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Activity

  1. reopened this on Feb 3, 2026
  2. LFDanLu commented on Aug 12, 2026

    @LFDanLu
    Member

    putting this one under #10182 since it should be covered by a fix to that scroll code a well

  3. nwidynski commented on Aug 13, 2026

    @nwidynski
    Contributor

    @LFDanLu This is issue is pretty old. Its possible solution calls for getBoundingClientRect(), which we already use, so I believe this is already resolved and unrelated to the jumps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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