Skip to content

Fix false positive and inconsistent scroll shadow in commit description - #21827

Closed
hi2242 wants to merge 3 commits into
desktop:developmentfrom
hi2242:issue-21735
Closed

hi2242 wants to merge 3 commits into
desktop:developmentfrom
hi2242:issue-21735

Conversation

@hi2242

@hi2242 hi2242 commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

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:

  1. Fix False Positive at the Bottom (TSX Calculation)
    Previously, elem.offsetHeight was 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 onDescriptionTextAreaScroll in commit-message.tsx to:
  • Use clientHeight instead of offsetHeight.
  • Use Math.ceil() on the scrollTop to prevent fractional pixel bugs.
  • Introduce a 10px tolerance to account for the un-scrolled bottom padding.
    Now, the shadow reliably disappears when the absolute bottom is reached.
  1. Fix Inconsistent State Update on Newlines (SCSS Fix)
    When deleting and re-typing newlines, the browser's native overflow-anchor feature 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.scss to 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.

hi2242 added 2 commits March 20, 2026 11:51
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
Copilot AI review requested due to automatic review settings March 20, 2026 03:05
@github-actions github-actions Bot added external Pull request originating outside of the Desktop core team needs-triage unmet-requirements and removed needs-triage labels Mar 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your pull request! Unfortunately, it doesn't meet the minimum requirements for review:

  • None of the referenced issues have the help wanted label

Please update your PR to address the above. Requirements:

  1. Include a detailed description of what this PR does
  2. Link to an issue with the help wanted label (use Fixes #123 or Closes #123 if it resolves the issue)

This PR will be automatically closed in 7 days if these requirements are not met.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 fractional scrollTop, and add a bottom tolerance when computing whether content is obscured.
  • Disable overflow-anchor for 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.

Comment thread app/src/ui/changes/commit-message.tsx Resolved
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Pull request originating outside of the Desktop core team unmet-requirements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent bottom border shadow visibility in commit description textarea

2 participants