Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): correct row offset calculation in translation editor #12981

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

meel-hd
Copy link
Collaborator

@meel-hd meel-hd commented Nov 9, 2024

Proposed changes

The logic used to the calculate scroll offset based on the closest tbody tag which is fine unless the space between them is very large (like in issue #3507) which hides the translation input. As a fix we calculate based on a closer element that can't grow in height very much to hide the translation input.

Checklist

  • Lint and unit tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added documentation to describe my feature.
  • I have squashed my commits into logic units.
  • I have described the changes in the commit messages.

Other information

The logic used to the calculate scroll offset based on the closest tbody tag which is fine unless the space between them is very large (like in issue WeblateOrg#3507) which hides the translation input. As a fix we calculate based on a closer element that can't grow in height very much to hide the translation input.
@meel-hd meel-hd requested a review from nijel November 11, 2024 10:27
@nijel
Copy link
Member

nijel commented Nov 11, 2024

The main intention here is to show the source string while the user navigates using the tab key. Your change destroys this (and mostly reverts to browser default behavior).

The whole thing is problematic because the content we want to show doesn't have to fit on the screen.

Ideas which could make it behave nicer:

  • Move the viewport in a way that the editor is at the bottom, showing as much content above as possible.
  • Do not adjust the viewport when the current editor was already focused.

@meel-hd
Copy link
Collaborator Author

meel-hd commented Nov 11, 2024

Or the editor should stick in the bottom of the screen when it goes out of view. It will insure the user can scroll freely to view anything and be able to edit anywhere
Example

Recording.2024-11-11.141026.mp4

@nijel
Copy link
Member

nijel commented Nov 11, 2024

Great idea, it definitely makes sense as long as the editor is focused.

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.

2 participants