From 7d1677fc8699719b557feae2462cc23397f579c1 Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Fri, 28 Jan 2022 13:24:29 +0000 Subject: [PATCH] fix(client): show description when above line 1 --- client/src/templates/Challenges/classic/editor.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/templates/Challenges/classic/editor.tsx b/client/src/templates/Challenges/classic/editor.tsx index d7843ae9e5..967395ec3a 100644 --- a/client/src/templates/Challenges/classic/editor.tsx +++ b/client/src/templates/Challenges/classic/editor.tsx @@ -890,14 +890,14 @@ const Editor = (props: EditorProps): JSX.Element => { // if ( // isEqual({ ..._editor.getPosition() }, { lineNumber: 1, column: 1 }) // ) { + const [top, bottom] = editableRegionBoundaries; editor.setPosition({ - lineNumber: editableRegionBoundaries[0] + 1, + lineNumber: top + 1, column: 1 }); - editor.revealLinesInCenter( - editableRegionBoundaries[0], - editableRegionBoundaries[1] - ); + + // To prevent descriptionWidget from being out of view + editor.revealLinesInCenter(top, top === 0 ? 1 : bottom); // } }