-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Desktop: Fix editor/viewer loses focus when visible panels are changed with ctrl-l #11029
Desktop: Fix editor/viewer loses focus when visible panels are changed with ctrl-l #11029
Conversation
@@ -132,9 +131,14 @@ export default class NoteTextViewerComponent extends React.Component<Props, any> | |||
public focus() { | |||
if (this.webviewRef_.current) { | |||
focus('NoteTextViewer::focus', this.webviewRef_.current); | |||
this.send('focus'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, after .focus
ing the viewer, the arrow keys didn't scroll the viewer's content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you this comment in the code? I'm not a big fan of having two different ways to focus something but if it's an exception we can leave it but with a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original Edit: Tests fail when focus('NoteTextViewer::focus', this.webviewRef_.current);
seems to be unnecessary — I've removed it (leaving this.send('focus')
) and added a comment.focus(..., webviewRef)
is removed. Additionally, without it, .focus
ing the viewer doesn't seem to work when not triggered by user interaction.
Related to #10795. |
Summary
This pull request fixes an issue originally reported on the forum — focusing the editor, then pressing ctrl-l to cycle through the different editor/viewer layouts causes focus to be lost.
This pull request causes the
toggleEditorLayout
command to refocus the editor or viewer such that the note editor retains focus on layout change. In particular,Testing plan
This pull request includes an automated test. It has also been tested manually on Fedora 40 using the following steps: