Open
Conversation
cif
approved these changes
May 9, 2024
Contributor
Author
|
@jassmith for merge? |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses an issue with scrolling by pixels by modifying both the example story and the core scrolling behavior.
- In the story file, it adds a button to scroll horizontally by a fixed pixel amount.
- In the data editor file, it adjusts the scroll initialization to use provided desired scroll positions.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/docs/examples/imperative-scroll.stories.tsx | Adds a button and handler to scroll horizontally by a fixed pixel value, demonstrating pixel-based scrolling. |
| packages/core/src/data-editor/data-editor.tsx | Updates the default scroll positions to use external desired values for improved scrolling accuracy. |
Comments suppressed due to low confidence (1)
packages/core/src/data-editor/data-editor.tsx:1499
- [nitpick] The change to use desiredX and desiredY improves flexibility; consider adding a brief comment to clarify the intended behavior and usage of these external scroll position values.
let scrollX = desiredX ?? 0;
Comment on lines
+45
to
+48
| const pixels = 1_000_000_000; | ||
| const onClickEnd = () => { | ||
| ref.current?.scrollTo({ | ||
| amount: pixels, |
There was a problem hiding this comment.
[nitpick] The fixed pixel value of 1,000,000,000 is extreme and may produce inconsistent behavior on different devices. Consider calculating the scroll offset dynamically based on the scroll container’s dimensions to ensure reliable behavior.
Suggested change
| const pixels = 1_000_000_000; | |
| const onClickEnd = () => { | |
| ref.current?.scrollTo({ | |
| amount: pixels, | |
| const onClickEnd = () => { | |
| const containerWidth = ref.current?.getBoundingClientRect()?.width || 0; | |
| const maxScrollOffset = containerWidth * 2; // Example: Scroll twice the container's width | |
| ref.current?.scrollTo({ | |
| amount: maxScrollOffset, |
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.
Peek.2024-05-09.10-48.mp4