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: focus issue on translate modal, remove duplicate code #5630

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

luka-nextcloud
Copy link
Contributor

@luka-nextcloud luka-nextcloud commented Apr 5, 2024

📝 Summary

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

@luka-nextcloud
Copy link
Contributor Author

@max-nextcloud Could you please review again?

Copy link
Collaborator

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

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

Code looks good. One comment on the scenario with no selected text. Also tests would be nice as this was a regression and we might break it again.

return commands.insertContentAt(range, content)
})
this.displayTranslate = false
emit('text:translate-modal:show', { content: this.selection || '' })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this even make sense if the selection is empty?
The previous code looks as if it did not open the modal on an empty selection:

			this.displayTranslate = this.selection

However I just tried it on cloud.nextcloud.com and there it opened anyway but did not work (due to the broken input but also as it had no content).

Copy link
Contributor Author

@luka-nextcloud luka-nextcloud Apr 17, 2024

Choose a reason for hiding this comment

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

@max-nextcloud

Does this even make sense if the selection is empty?

The modal should be open anyway. User is free to update the input text.
If selection is empty, all content will be selected. I updated this behavior to same as action on menu bar.

PR updated:

  • select all if selection is empty when open translate dialog
  • add cypress test

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the $editor.selectAll have some sideeffects? Is the text selected fully afterwards? Otherwise this sounds good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@max-nextcloud I didn't find any side effects. Yes, the text is selected fully.

@luka-nextcloud luka-nextcloud force-pushed the bugfix/focus-on-translate-modal branch from 77e5121 to 747bfa8 Compare April 17, 2024 09:14
@juliushaertl
Copy link
Member

Restarted failing cypress test which seemed unrelated

Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
@luka-nextcloud luka-nextcloud force-pushed the bugfix/focus-on-translate-modal branch from 747bfa8 to 9e5b885 Compare April 26, 2024 09:52
@luka-nextcloud luka-nextcloud merged commit 8d7f24b into main Apr 26, 2024
60 checks passed
@luka-nextcloud luka-nextcloud deleted the bugfix/focus-on-translate-modal branch April 26, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translation modal language selection is not possible
4 participants