From 461e4295980fa6cc3f8d9f752beef605a05c1109 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Fri, 8 Oct 2021 23:14:15 +0200 Subject: [PATCH] fix(client): prevent jumping between editor tabs (#43771) --- client/src/templates/Challenges/classic/editor.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/templates/Challenges/classic/editor.tsx b/client/src/templates/Challenges/classic/editor.tsx index 47fad7b12b..2883359f6e 100644 --- a/client/src/templates/Challenges/classic/editor.tsx +++ b/client/src/templates/Challenges/classic/editor.tsx @@ -967,10 +967,13 @@ const Editor = (props: EditorProps): JSX.Element => { updateOutputZone(); } - editor?.focus(); - if (isProjectStep() && editor) { - if (hasChangedContents) showEditableRegion(editor); + if (hasChangedContents && !isProjectStep()) editor?.focus(); + if (isProjectStep() && editor) { + if (hasChangedContents) { + editor.focus(); + showEditableRegion(editor); + } // resetting test output // TODO: DRY this - createOutputNode doesn't also need to set this up. const testButton = document.getElementById('test-button');