Skip to content

fix: avoid jumping when opening a translation editor - #4101

Open
vaibhavmashal wants to merge 1 commit into
tolgee:mainfrom
vaibhavmashal:vaibhavmashal/fix-translation-editor-scroll-jump
Open

vaibhavmashal wants to merge 1 commit into
tolgee:mainfrom
vaibhavmashal:vaibhavmashal/fix-translation-editor-scroll-jump

Conversation

@vaibhavmashal

@vaibhavmashal vaibhavmashal commented Nov 28, 2026 •

Copy link
Copy Markdown

Summary

Opening a translation editor currently centers the selected cell in the list, even when it is already visible. Align the cell to the nearest edge so opening it only scrolls the list when needed. Cells outside the viewport still scroll into view.

Fixes #4092

Verification

  • In a Chromium fixture using the translation editor's scroll settings, upstream shifted a visible cell by 167 pixels vertically. With this change, the visible cell stayed in place and an offscreen cell smoothly scrolled into view.
  • Frontend unit suite: 381 tests passed across 49 files on Node 24.
  • Frontend ESLint passed with Windows-native line endings. The committed LF source also passed ESLint with the standard settings.

Summary by CodeRabbit

  • Bug Fixes
    • Updated scrolling to bring the target into the nearest visible position horizontally and vertically, rather than centering it.

Signed-off-by: vaibhavmashal <vaibhavmashal098@gmail.com>
Copilot AI balanced review requested due to automatic review settings November 28, 2026 14:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The translation position service now aligns scroll targets to the nearest visible position on both axes. Smooth scrolling remains enabled.

Changes: Translation scroll alignment

Layer / File(s) Summary
Update scroll alignment
webapp/src/views/projects/translations/context/services/usePositionService.tsx
The scroll request uses nearest alignment on both axes instead of centering the target. Smooth scrolling remains enabled.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: stepan662, dkrizan

Merge Risk: Minimal · up to 5795e

The translation list should no longer jump when an editor opens. Cells already in view stay put, and offscreen cells scroll into view. The change is a small, easily reversible scroll-option adjustment with no outstanding merge-blocking concerns.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix: avoid jumping when opening a translation editor" matches the main change. The PR changes the scroll request in usePositionService so the target cell aligns to the nearest visible edge …
Linked Issues check Passed Issue #4092 requires that clicking a translation does not make the UI jump. The reviewed head changes the scroll request in usePositionService.tsx from block: 'center', inline: 'center' to `block:…
Out of Scope Changes check Passed The whole-PR diff against the merge base changes one line in webapp/src/views/projects/translations/context/services/usePositionService.tsx. The change only alters the scroll alignment options for t…
Full details: Title check

Explanation

The title "fix: avoid jumping when opening a translation editor" matches the main change. The PR changes the scroll request in usePositionService so the target cell aligns to the nearest visible edge instead of being centered. This stops the translation list from jumping when an editor opens, which is the goal stated in the linked issue and PR objectives. The title is short, specific, and follows a conventional commit style.

Full details: Linked Issues check

Explanation

Issue #4092 requires that clicking a translation does not make the UI jump. The reviewed head changes the scroll request in usePositionService.tsx from block: 'center', inline: 'center' to block: 'nearest', inline: 'nearest', keeping behavior: 'smooth'. With nearest, an already-visible cell does not scroll, which removes the forced re-centering that causes the jump. Offscreen cells still scroll into view. The PR reports a Chromium fixture check: a visible cell that previously shifted 167 px stayed in place after the change. The issue has no automated test requirement. The diff does not add a unit test for this behavior. The evidence for the fix is the author's manual fixture check, not an automated test. That check supports the requirement, so the result is PASS.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base changes one line in webapp/src/views/projects/translations/context/services/usePositionService.tsx. The change only alters the scroll alignment options for the element that the translation editor opens. This directly implements the objective of #4092. No unrelated files or changes appear in the reviewed diff. The raw summary also reports no changes to exported or public declarations, which matches the one-line diff.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between eecf317 and 5795e6c.

Files selected for processing: 1

  • webapp/src/views/projects/translations/context/services/usePositionService.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@Barush
Barush requested a review from Anty0 November 28, 2026 20:46
@Barush

Barush commented Nov 28, 2026

Copy link
Copy Markdown
Member

Hi @vaibhavmashal, thank you for this PR! The jumping is really annoying, so we are happy to see a fix for it.

We have not reviewed the code yet. Our team needs to look at it and try it in the app. We can't promise a date. We will follow up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translations jump like crazy

3 participants