Skip to content

Commit

Permalink
Fix arrow keys in text inputs (#10244)
Browse files Browse the repository at this point in the history
Fixes #10239

# Important Notes
This is a quick fix, but we may consider better focus handling - perhaps the graph editor should be focusable?
  • Loading branch information
farmaazon authored Jun 11, 2024
1 parent 4da5e61 commit a2c4d94
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/gui2/src/components/CodeEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ const editorStyle = computed(() => {
ref="rootElement"
class="CodeEditor"
:style="editorStyle"
@keydown.arrow-left.stop
@keydown.arrow-right.stop
@keydown.arrow-up.stop
@keydown.arrow-down.stop
@keydown.enter.stop
@keydown.backspace.stop
@keydown.delete.stop
Expand Down
2 changes: 2 additions & 0 deletions app/gui2/src/components/ComponentBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ const handler = componentBrowserBindings.handler({
@keydown.enter.stop
@keydown.backspace.stop
@keydown.delete.stop
@keydown.arrow-left.stop
@keydown.arrow-right.stop
>
<div class="panels">
<div class="panel components">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export const widgetDefinition = defineWidget(
@pointerdown.stop
@click.stop
@keydown.enter.stop
@keydown.arrow-left.stop
@keydown.arrow-right.stop
/>
</div>
</template>
Expand Down
2 changes: 0 additions & 2 deletions app/gui2/src/components/GraphEditor/widgets/WidgetText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ export const widgetDefinition = defineWidget(
ref="input"
v-model="editedContents"
autoSelect
@pointerdown.stop
@click.stop
@keydown.enter.stop="accepted"
@focusin="editing.start()"
@input="editing.edit(makeLiteralFromUserInput($event ?? ''))"
Expand Down
11 changes: 10 additions & 1 deletion app/gui2/src/components/lexical/LexicalContent.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<template>
<div ref="lexicalElement" class="LexicalContent" spellcheck="false" contenteditable="true" />
<div
ref="lexicalElement"
class="LexicalContent"
spellcheck="false"
contenteditable="true"
@keydown.arrow-left.stop
@keydown.arrow-right.stop
@keydown.arrow-up.stop
@keydown.arrow-down.stop
/>
</template>

<style scoped>
Expand Down
4 changes: 4 additions & 0 deletions app/gui2/src/components/widgets/AutoSizedInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,12 @@ defineExpose({
v-model="innerModel"
class="AutoSizedInput"
:style="inputStyle"
@pointerdown.stop
@click.stop
@keydown.backspace.stop
@keydown.delete.stop
@keydown.arrow-left.stop
@keydown.arrow-right.stop
@keydown.enter.stop="onEnterDown"
@input="emit('input', innerModel)"
@change="onChange"
Expand Down

0 comments on commit a2c4d94

Please sign in to comment.