Skip to content

Commit

Permalink
🐛 playsite: Fix scroll bug (#452)
Browse files Browse the repository at this point in the history
Fix scroll bug where when an Evy program was started with ctrl+enter on
the playsite or labsite and there was an `on key` eventhandler handling
arrow key movements, the Evy code editor **also** started scrolling.

This behavior _only_ occurred when the Evy program was started with
ctrl+enter shortcut, not with the Run button.

Pull-request: #452
  • Loading branch information
juliaogris authored Nov 11, 2024
1 parent 76faf9b commit 6ab3696
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/lab/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ <h2>🚀 Let's get started!</h2>
</pre>
</div>
</div>
<div class="output">
<div class="output" tabindex="0">
<div class="canvas"><canvas id="canvas"></canvas></div>
<div class="read hidden">
<label for="read">input&gt;</label>
Expand Down
1 change: 1 addition & 0 deletions frontend/play/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ dialog .err,
margin: 0;
border: var(--output-border);
border-top-width: var(--output-border-top-width);
outline: none;
}

.output .canvas {
Expand Down
2 changes: 1 addition & 1 deletion frontend/play/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
</pre>
</div>
</div>
<div class="output">
<div class="output" tabindex="0">
<div class="canvas"><canvas id="canvas"></canvas></div>
<div class="read hidden">
<label for="read">input&gt;</label>
Expand Down
1 change: 1 addition & 0 deletions frontend/play/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ function unfocusRunButton() {

function keydownListener(e) {
if (e.target.id == "evy-editor") return // skip for source code input
document.querySelector(".output").focus()
const { ptr, len } = stringToMem(e.key)
wasmInst.exports.onKey(ptr, len)
}
Expand Down

0 comments on commit 6ab3696

Please sign in to comment.