Skip to content
Snippets Groups Projects
Commit 18288af5 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

fix: use form submit event for confirm actions

This way users can enter the prompt value and just hit enter.
parent c1e938b1
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
<ADialog ref="dialog" is-modal class="md:tw-w-[600px]" @close="emit('cancel')">
<slot />
<div v-if="promptValue" class="tw-mt-3">
<form v-if="promptValue" :id="formId" class="tw-mt-3" @submit.prevent.stop="confirm">
<SafeHTML
v-if="promptLabel"
:id="promptLabelId"
......@@ -20,16 +20,16 @@
:aria-labelledby="promptLabelId"
/>
</FormGroup>
</div>
</form>
<template #footer>
<div class="tw-flex tw-items-center tw-gap-3">
<button
type="button"
type="submit"
class="btn"
:form="formId"
:class="confirmClass ?? 'btn-danger'"
:disabled="!canConfirm"
@click="confirm"
>
<SafeHTML :html="confirmLabel" sanitize-preset="inline-noninteractive" />
</button>
......@@ -62,6 +62,7 @@ const emit = defineEmits<{ cancel: []; confirm: [] }>()
const { t } = useI18n()
const dialog = ref()
const promptLabelId = useId('confirm-dialog-prompt-label')
const formId = useId('confirm-dialog-form')
const promptVerifyValue = ref('')
const canConfirm = computed(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment