From 2c28312fc957901b86c2f3d1db8fc3376f505d37 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 21 Apr 2023 15:43:36 +0200 Subject: [PATCH] fix(front): Focus report comment input in report modal Closes #1236 Signed-off-by: Thomas Citharel --- js/src/components/Comment/EventComment.vue | 2 + .../components/Event/EventActionSection.vue | 2 + js/src/components/Report/ReportModal.vue | 72 ++++++++++--------- js/src/components/core/CustomDialog.vue | 8 +++ js/src/plugins/dialog.ts | 1 + js/src/views/Group/GroupView.vue | 7 +- js/src/views/Posts/PostView.vue | 2 + 7 files changed, 58 insertions(+), 36 deletions(-) diff --git a/js/src/components/Comment/EventComment.vue b/js/src/components/Comment/EventComment.vue index 4792553f..d0069c25 100644 --- a/js/src/components/Comment/EventComment.vue +++ b/js/src/components/Comment/EventComment.vue @@ -194,6 +194,8 @@ has-modal-card ref="reportModal" :close-button-aria-label="t('Close')" + :autoFocus="false" + :trapFocus="false" > -
-
-
-
-
- -
- -
-
-
- {{ comment?.actor?.name }} - @{{ usernameWithDomain(comment?.actor) }} -
-

-
-
-
-
+
+
+
+
+ +
+ +
+
+ {{ comment?.actor?.name }} + @{{ usernameWithDomain(comment?.actor) }} +
+

+
+
- +
@@ -91,6 +93,7 @@ import { useI18n } from "vue-i18n"; import { IComment } from "../../types/comment.model"; import { usernameWithDomain } from "@/types/actor"; import AccountCircle from "vue-material-design-icons/AccountCircle.vue"; +import { useFocus } from "@vueuse/core"; const props = withDefaults( defineProps<{ @@ -108,18 +111,17 @@ const props = withDefaults( const emit = defineEmits(["close"]); -// @Component({ -// mounted() { -// this.$data.isActive = true; -// }, -// }) - -// isActive = false; - const content = ref(""); const forward = ref(false); +const reportAdditionalCommentsInput = ref(); +// https://github.com/oruga-ui/oruga/issues/339 +const reportAdditionalCommentsInputComp = computed( + () => reportAdditionalCommentsInput.value?.$refs.textarea +); +useFocus(reportAdditionalCommentsInputComp, { initialValue: true }); + const { t } = useI18n({ useScope: "global" }); const translatedCancelText = computed((): string => { diff --git a/js/src/components/core/CustomDialog.vue b/js/src/components/core/CustomDialog.vue index c2de32cf..df802e04 100644 --- a/js/src/components/core/CustomDialog.vue +++ b/js/src/components/core/CustomDialog.vue @@ -31,6 +31,7 @@ ref="input" v-bind="inputAttrs" @keydown.enter="confirm" + autofocus />
@@ -48,6 +49,7 @@