Repository navigation
Conversation
Update the scroll shadow calculation in `onDescriptionTextAreaScroll` to use `clientHeight` instead of `offsetHeight`, add `Math.ceil` for fractional pixel precision, and introduce a 10px tolerance. This prevents the bottom shadow from incorrectly appearing when the user reaches the bottom of the textarea due to padding and native caret scrolling behavior. Fixes desktop#21735
Add `overflow-anchor: none` to the commit description textarea. This prevents the browser from forcibly remembering and snapping to previous scroll depths when newlines are deleted or added, ensuring the scroll shadow updates consistently. Fixes desktop#21735
Contributor
|
Thanks for your pull request! Unfortunately, it doesn't meet the minimum requirements for review:
Please update your PR to address the above. Requirements:
This PR will be automatically closed in 7 days if these requirements are not met. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an inconsistent “bottom overflow” shadow in the commit description textarea by adjusting the scroll-position calculation and disabling browser scroll anchoring that interferes with newline edits.
Changes:
- Update commit description scroll handling to use
clientHeight, account for fractionalscrollTop, and add a bottom tolerance when computing whether content is obscured. - Disable
overflow-anchorfor the commit description textarea to prevent scroll anchoring from desynchronizing shadow state.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/styles/ui/changes/_commit-message.scss | Disables scroll anchoring on the commit description textarea to stabilize shadow updates during content edits. |
| app/src/ui/changes/commit-message.tsx | Refines overflow/shadow detection by changing the bottom-distance calculation and introducing a tolerance. |
Replace the hardcoded 10px magic number with a dynamic tolerance derived from the textarea's actual CSS `paddingBottom`. To ensure performance and prevent layout thrashing during high-frequency scroll events, the `window.getComputedStyle` call is executed only once and cached when the textarea mounts (`onDescriptionTextAreaRef`), rather than inside the scroll handler. The tolerance is set to 2x the computed padding to reliably handle the browser's native caret scrolling gaps while maintaining UI consistency even if CSS spacing variables change in the future.
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.
Closes #21735
Description
This PR addresses a UI bug regarding the bottom border scroll shadow in the commit description textarea, where the shadow behaves inconsistently and shows false positives at the bottom.
Currently, there are two issues caused by how the browser handles scrolling and how the scroll height is calculated. I have addressed both:
Previously,
elem.offsetHeightwas used, which includes borders and causes miscalculations. Additionally, browsers do not always scroll fully through the bottom padding when pressing 'Enter', and high-DPI displays introduce fractional pixels.To fix this, I updated
onDescriptionTextAreaScrollincommit-message.tsxto:clientHeightinstead ofoffsetHeight.Math.ceil()on thescrollTopto prevent fractional pixel bugs.10pxtolerance to account for the un-scrolled bottom padding.Now, the shadow reliably disappears when the absolute bottom is reached.
When deleting and re-typing newlines, the browser's native
overflow-anchorfeature was aggressively locking the scroll position to previous depths, causing the shadow calculation to fall out of sync with the visual state.I added
overflow-anchor: none;to the textarea in_commit-message.scssto disable this behavior. The scroll state and shadow now update consistently no matter how many lines are added or removed.Screenshots
[Before] Fix False Positive at the Bottom (TSX Calculation)
inconsistency.of.bottom.borderline.shadow.in.overflow.Before.-.1.mp4
[After] Fix False Positive at the Bottom (TSX Calculation)
inconsistency.of.bottom.borderline.shadow.in.overflow.After.-.1.mp4
[Before] Fix Inconsistent State Update on Newlines (SCSS Fix)
inconsistency.of.bottom.borderline.shadow.in.overflow.Before.-.2.mp4
[After] Fix Inconsistent State Update on Newlines (SCSS Fix)
inconsistency.of.bottom.borderline.shadow.in.overflow.After.-.2.mp4
Release notes
Notes: Fixed an issue where the commit description scroll shadow would appear incorrectly or behave inconsistently at the bottom of the text area.