Skip to content

Prevent transform transitions from affecting translate percentage probes #203

Description

@coderabbitai

Summary

Prevent active transform CSS transitions from affecting the temporary transform probe used to normalize percentage translate components.

Rationale

probeTranslateMatrix in src/core/normalizer/rules/translate-percentage.ts temporarily assigns transform and reads getComputedStyle(el).transform. If the element has a non-zero transition for transform, the browser can return an interpolated matrix. This can convert a percentage component to an incorrect pixel value.

Required changes

  • In src/core/normalizer/rules/translate-percentage.ts, temporarily disable the transform transition while probeTranslateMatrix sets and reads the temporary transform.
  • Restore the original inline transition value and priority in the existing finally block.
  • Preserve the existing restoration behavior for the inline transform value and priority.
  • Add a regression test in the normalizer test suite. The test must use a non-zero transform transition and confirm that normalization uses the un-interpolated transform matrix.

Affected area

  • src/core/normalizer/rules/translate-percentage.ts
  • test/core/normalizer.test.ts

Backlinks

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions