Skip to content

Comments

Dynamic Hover Slot Scroll Jump Workaround#335

Merged
amadeus merged 1 commit intomainfrom
amadeus/safari-hover-slot-workaround
Feb 14, 2026
Merged

Dynamic Hover Slot Scroll Jump Workaround#335
amadeus merged 1 commit intomainfrom
amadeus/safari-hover-slot-workaround

Conversation

@amadeus
Copy link
Member

@amadeus amadeus commented Feb 14, 2026

Basically we should only use the container-type css when we absolutely need it (when using line-info), so we can enable safari based workarounds for the dynamic hover slot breakage.

This means that if using enableHoverUtility in Safari, you can opt into any type other than line-info to not bug out scrolling when the hover utility jumps around

Basically we should only use the container-type css when we absolutely
need it (when using `line-info`), so we can enable safari based
workarounds for the dynamic hover slot breakage
@vercel
Copy link

vercel bot commented Feb 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierrejs-diff-demo Ready Ready Preview Feb 14, 2026 2:47am
pierrejs-docs Error Error Feb 14, 2026 2:47am

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a Safari-specific workaround for scroll jump issues related to CSS container queries. The container-type: inline-size CSS property is now conditionally applied only when hunkSeparators is set to 'line-info', allowing users to opt into other separator types to avoid scrolling bugs when using the hover utility feature in Safari.

Changes:

  • Added conditional data-container-size attribute that is only set when hunkSeparators === 'line-info'
  • Moved container-type: inline-size CSS from being always applied to being conditionally applied via the [data-container-size] selector
  • Refactored getOrCreateCodeNode utility to use setAttribute instead of dataset for consistency with codebase patterns

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/diffs/test/DiffHunksRender.test.ts Added tests verifying data-container-size is added for line-info and not added for other separator types
packages/diffs/src/utils/getOrCreateCodeNode.ts Added containerSize parameter and logic to conditionally set/remove data-container-size attribute; refactored to use setAttribute
packages/diffs/src/style.css Moved container-type: inline-size to new [data-container-size] selector
packages/diffs/src/renderers/DiffHunksRenderer.ts Added conditional logic to set data-container-size property based on hunkSeparators === 'line-info'
packages/diffs/src/components/FileDiff.ts Added containerSize calculation and passed it to getOrCreateCodeNode

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@amadeus amadeus merged commit e1d5682 into main Feb 14, 2026
13 of 14 checks passed
@amadeus amadeus deleted the amadeus/safari-hover-slot-workaround branch February 14, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant