Skip to content

Commit 2822338

Browse files
authored
Merge pull request #17 from connorabbas/develop
dialog fixes
2 parents 160f06d + bd8b95e commit 2822338

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

resources/js/Pages/Profile/Partials/DeleteUserForm.vue

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { ref, useTemplateRef, watch, nextTick } from 'vue';
2+
import { ref, useTemplateRef } from 'vue';
33
import { useForm } from '@inertiajs/vue3';
44
import Dialog from 'primevue/dialog';
55
import InputError from '@/Components/InputError.vue';
@@ -20,25 +20,21 @@ const deleteUser = () => {
2020
});
2121
};
2222
23-
watch(modalOpen, (newModalOpen) => {
24-
if (newModalOpen) {
25-
nextTick(() => {
26-
passwordInput.value.$el.focus();
27-
});
28-
} else {
29-
form.clearErrors();
30-
}
31-
});
23+
function focusPasswordInput() {
24+
passwordInput.value.$el.focus();
25+
}
3226
</script>
3327

3428
<template>
3529
<section class="space-y-6">
3630
<Dialog
31+
:draggable="false"
3732
position="center"
3833
v-model:visible="modalOpen"
3934
modal
4035
header="Are you sure you want to delete your account?"
4136
:style="{ width: '40rem' }"
37+
@show="focusPasswordInput"
4238
>
4339
<div class="mb-6">
4440
<p class="m-0 text-muted-color">

resources/js/Pages/Profile/Partials/UpdatePasswordForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useToast } from 'primevue/usetoast';
55
import InputError from '@/Components/InputError.vue';
66
77
const currentPasswordInput = useTemplateRef('current-password-input');
8-
const passwordInput = useTemplateRef('password-input');
8+
const newPasswordInput = useTemplateRef('new-password-input');
99
1010
const toast = useToast();
1111
const form = useForm({
@@ -32,7 +32,7 @@ const updatePassword = () => {
3232
onError: () => {
3333
if (form.errors?.password) {
3434
form.reset('password', 'password_confirmation');
35-
passwordInput.value.$el.focus();
35+
newPasswordInput.value.$el.focus();
3636
}
3737
if (form.errors?.current_password) {
3838
form.reset('current_password');
@@ -79,7 +79,7 @@ const updatePassword = () => {
7979
<InputText
8080
required
8181
id="password"
82-
ref="password-input"
82+
ref="new-password-input"
8383
type="password"
8484
v-model="form.password"
8585
class="w-full"

0 commit comments

Comments
 (0)