Fix Numeric Input cooperation with Drop Down (#11091)

Fixes #11063

The blur on Numeric Input was removed in https://github.com/enso-org/enso/pull/10337 and then reintroduced in https://github.com/enso-org/enso/pull/10512. I guess it was to handle `tab` properly, so I added another way of handling `tab` and removed blur again (with explanation).

(cherry picked from commit 53e101566a)
This commit is contained in:
Adam Obuchowicz 2024-09-16 16:46:58 +02:00 committed by James Dunkerley
parent d337bc2b9f
commit 729ea72591
2 changed files with 14 additions and 1 deletions

View File

@ -75,6 +75,12 @@ export const widgetDefinition = defineWidget(
</script>
<template>
<!-- Do not finish edit on blur here!
It is tempting, but it breaks the cooperation with possible drop-down widget. Blur may be done on
pointerdown, and if it would end the interaction, the drop down would also be hidden, making
any `click` event on it impossible.
-->
<NumericInputWidget
ref="inputComponent"
class="WidgetNumber"
@ -84,7 +90,8 @@ export const widgetDefinition = defineWidget(
@update:modelValue="setValue"
@click.stop
@focus="editHandler.start()"
@blur="editHandler.end()"
@keydown.enter.stop="editHandler.end()"
@keydown.tab.stop="editHandler.end()"
@input="editHandler.edit($event)"
/>
</template>

View File

@ -98,6 +98,12 @@ export const widgetDefinition = defineWidget(
<template>
<label ref="widgetRoot" class="WidgetText widgetRounded">
<NodeWidget v-if="shownLiteral.open" :input="WidgetInput.FromAst(shownLiteral.open)" />
<!-- Do not finish edit on blur here!
It is tempting, but it breaks the cooperation with possible drop-down widget. Blur may be done on
pointerdown, and if it would end the interaction, the drop down would also be hidden, making
any `click` event on it impossible.
-->
<AutoSizedInput
ref="input"
v-model="editedContents"