Skip to content

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

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 Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

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:

  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 3 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
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.
@hi2242
hi2242 requested a review from a team as a code owner April 10, 2026 06:38
@hi2242
hi2242 requested review from Copilot and sergiou87 April 10, 2026 06:38
@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 Apr 10, 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

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 fractional scrollTop, 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.

Comment on lines +1148 to +1152
const bottomPaddingTolerancePx = this.descriptionTextAreaPaddingBottomPx * 2

const distanceToBottom =
elem.scrollHeight - elem.clientHeight - Math.ceil(elem.scrollTop)
const descriptionObscured = distanceToBottom > bottomPaddingTolerancePx

Copilot AI Apr 10, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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