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
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.
|
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. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a UI inconsistency in the commit description textarea where the bottom “more content” scroll shadow can appear when already at (or visually near) the bottom, and can get out of sync when editing newlines.
Changes:
- Adjust the commit description scroll-shadow calculation to use
clientHeight, handle fractionalscrollTop, and apply a bottom tolerance. - Disable browser scroll anchoring for the commit description textarea to prevent scroll position “sticking” and inconsistent shadow updates.
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 overflow-anchor on the description textarea to keep scroll/shadow state consistent during edits. |
| app/src/ui/changes/commit-message.tsx | Refines obscured-content detection for the description field by updating scroll math and using a padding-derived tolerance. |
| const bottomPaddingTolerancePx = this.descriptionTextAreaPaddingBottomPx * 2 | ||
|
|
||
| const distanceToBottom = | ||
| elem.scrollHeight - elem.clientHeight - Math.ceil(elem.scrollTop) | ||
| const descriptionObscured = distanceToBottom > bottomPaddingTolerancePx |
There was a problem hiding this comment.
bottomPaddingTolerancePx is computed as paddingBottom * 2, which makes the effective threshold non-obvious (and changes behavior if the textarea padding is adjusted). Consider either adding a short comment explaining why the tolerance is doubled here, or switching to a clearly named explicit tolerance value so future style tweaks don't unintentionally change the scroll-shadow behavior.
Comment
I am reopening this PR as my previous one (#21827) was automatically closed after a week without a review due to the repository's stale policy.
I completely understand that the maintainer team is very busy. Could you kindly let me know if this improvement is considered a lower priority (e.g. priority-3) and might be reviewed later, or if the team has no plans to review/merge it?
Any feedback or direction would be greatly appreciated so I know whether to keep this PR updated. Thank you!
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.