Dynamic Hover Slot Scroll Jump Workaround#335
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
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-sizeattribute that is only set whenhunkSeparators === 'line-info' - Moved
container-type: inline-sizeCSS from being always applied to being conditionally applied via the[data-container-size]selector - Refactored
getOrCreateCodeNodeutility to usesetAttributeinstead ofdatasetfor 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-infoto not bug out scrolling when the hover utility jumps around