Skip to content

Commit 636b6ea

Browse files
authored
Focus editor on "Write" tab click (#26714)
Focus the editor when clicking the "Write" tab. Works for both Textarea and EasyMDE. Does for some reason not work without the `requestAnimationFrame`.
1 parent 390ec61 commit 636b6ea

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

web_src/js/features/comp/ComboMarkdownEditor.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ class ComboMarkdownEditor {
135135
$panelPreviewer.attr('data-tab', `markdown-previewer-${elementIdCounter}`);
136136
elementIdCounter++;
137137

138+
$tabEditor[0].addEventListener('click', () => {
139+
requestAnimationFrame(() => {
140+
this.focus();
141+
});
142+
});
143+
138144
$tabs.tab();
139145

140146
this.previewUrl = $tabPreviewer.attr('data-preview-url');

0 commit comments

Comments
 (0)