Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MS] Fix FileControlsInput blur on enter & esc events #9601

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions client/src/components/viewers/controls/FileControlsInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
@ion-blur="onFocusChanged(false)"
@ion-focus="onFocusChanged(true)"
@ion-input="onChange($event.detail.value || '')"
@keyup.enter="editing = false"
@keyup.esc="editing = false"
@keyup.enter="blur"
@keyup.esc="blur"
:disabled="$props.disabled"
>
<span
Expand Down Expand Up @@ -78,9 +78,7 @@ async function setFocus(): Promise<void> {

async function onFocusChanged(focus: boolean): Promise<void> {
if (focus === false) {
lostFocus.value = true;
editing.value = false;
await onSubmittedValue(props.modelValue || '');
await blur();
}
emits('onFocusChanged', focus);
}
Expand Down Expand Up @@ -116,6 +114,12 @@ async function onTextClick(): Promise<void> {
function isEditing(): boolean {
return editing.value;
}

async function blur(): Promise<void> {
lostFocus.value = true;
editing.value = false;
await onSubmittedValue(props.modelValue || '');
}
</script>

<style lang="scss" scoped>
Expand Down
Loading