Khan / Khan/live-editor

Resizing a webpage's width sets it to 400px tall regardless of starting height

Open Beginner friendly
#738 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

When a webpage's height is changed through settings or a query string, then drag-resized by the user, the frame snaps down to 400px height and can't be fixed without reloading the page. A bit of debugging narrows down the issue to https://github.com/Khan/live-editor/blob/master/js/live-editor.js#L1405. Since no height is passed to the updateCanvasSize function when it's resized by the user, it uses the default, which is 400.
```js
height = height || this.defaultOutputHeight;
```
could be changed to
```js
height = height || this.editorHeight || this.defaultOutputHeight;
```
I tested this with the console after the page loaded and it fixed it.

Edit:
Changing the objects default to whatever it started with when the editor is initialized would be better, since the editor's height is supposed to be able to be dragged, but the canvas's height is meant to be static.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at js/live-editor.js around line 1405 and inspect updateCanvasSize, then reproduce a page whose height was set through settings or a query string before user resizing. Confirm that resizing preserves the initialized editor height instead of snapping to 400px, including the distinction between the editor height and the static canvas height.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.