From 385969e9f56a39a1e5547b94901d155e1e811263 Mon Sep 17 00:00:00 2001
From: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
Date: Fri, 12 Jul 2024 16:25:44 +0900
Subject: fix(frontend): フォーカスの挙動を修正 (#14158)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* fix(frontend): 直前のパターンを記録するように
* fix(frontend): フォーカス/タブ移動に関する挙動を調整 (#226)
Cherry-pick commit e8c030673326871edf3623cf2b8675d68f9e1b13
Co-authored-by: taiyme <53635909+taiyme@users.noreply.github.com>
* focusのデザイン修正
* move scripts
* Modalにfocus trapを追加
* 記録するホットキーはレートリミット式にする
* escキーのハンドリングをMkModalに統一
* fix
* enterで子メニューを開けるように
* lint
* fix focus trap
* improve switch accessibility
* 一部のmodalのフォーカストラップが外れない問題を修正
* fix
* fix
* Revert "記録するホットキーはレートリミット式にする"
This reverts commit 40a7509286a87911ad4cc06d9482e8a2e5d0e7e8.
* Revert "fix(frontend): 直前のパターンを記録するように"
This reverts commit 5372b2594023952cff34aa62253ed4efef15b5dd.
* Revert "Revert "fix(frontend): 直前のパターンを記録するように""
This reverts commit a9bb52e799e110927ad92cd8f26af980819334e1.
* Revert "Revert "記録するホットキーはレートリミット式にする""
This reverts commit bdac34273e0bc5f13604c7e2f9fa6b1321a0df3d.
* 試験的にCypressでのFocustrapを無効化
* fix
* fix focus-trap
* Update Changelog
* :v:
* fix focustrap invocation logic
* スクロールがsticky headerを考慮するように
* :art:
* スタイルの微調整
* :art:
* remove deprecated key aliases
* focusElementが足りなかったので修正
* preview系にfocus時スタイルが足りなかったので修正
* `returnFocusElement` -> `returnFocusTo`
* lint
* Update packages/frontend/src/components/MkModalWindow.vue
* Apply suggestions from code review
Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com>
* keydownイベントをまとめる
* use correct pesudo-element selector
* fix
* rename
---------
Co-authored-by: taiyme <53635909+taiyme@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
---
packages/frontend/src/components/MkNote.vue | 48 +++++++++++++----------------
1 file changed, 21 insertions(+), 27 deletions(-)
(limited to 'packages/frontend/src/components/MkNote.vue')
diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue
index fc72813285..420ff2c651 100644
--- a/packages/frontend/src/components/MkNote.vue
+++ b/packages/frontend/src/components/MkNote.vue
@@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="rootEl"
v-hotkey="keymap"
:class="[$style.root, { [$style.showActionsOnlyHover]: defaultStore.state.showNoteActionsOnlyHover }]"
- :tabindex="!isDeleted ? '-1' : undefined"
+ :tabindex="isDeleted ? '-1' : '0'"
>
{{ i18n.ts.pinnedNote }}
@@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-
-
+
@@ -110,7 +110,7 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="renoteButton"
:class="$style.footerButton"
class="_button"
- @mousedown="renote()"
+ @mousedown.prevent="renote()"
>
{{ number(appearNote.renoteCount) }}
@@ -125,10 +125,10 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ number(appearNote.reactionCount) }}
-
+
-
+
@@ -175,7 +175,6 @@ import MkUsersTooltip from '@/components/MkUsersTooltip.vue';
import MkUrlPreview from '@/components/MkUrlPreview.vue';
import MkInstanceTicker from '@/components/MkInstanceTicker.vue';
import { pleaseLogin } from '@/scripts/please-login.js';
-import { focusPrev, focusNext } from '@/scripts/focus.js';
import { checkWordMute } from '@/scripts/check-word-mute.js';
import { userPage } from '@/filters/user.js';
import number from '@/filters/number.js';
@@ -199,6 +198,7 @@ import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
import { shouldCollapsed } from '@/scripts/collapsed.js';
import { isEnabledUrlPreview } from '@/instance.js';
import { type Keymap } from '@/scripts/hotkey.js';
+import { focusPrev, focusNext } from '@/scripts/focus.js';
const props = withDefaults(defineProps<{
note: Misskey.entities.Note;
@@ -257,6 +257,7 @@ const renoteTime = shallowRef();
const reactButton = shallowRef();
const clipButton = shallowRef();
const appearNote = computed(() => isRenote ? note.value.renote as Misskey.entities.Note : note.value);
+const galleryEl = shallowRef>();
const isMyRenote = $i && ($i.id === note.value.userId);
const showContent = ref(false);
const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null);
@@ -318,7 +319,7 @@ const keymap = {
},
'o': () => {
if (renoteCollapsed.value) return;
- showMenu();
+ galleryEl.value?.openGallery();
},
'v|enter': () => {
if (renoteCollapsed.value) {
@@ -419,7 +420,7 @@ function renote(viaKeyboard = false) {
});
}
-function reply(viaKeyboard = false): void {
+function reply(): void {
pleaseLogin();
if (props.mock) {
return;
@@ -427,13 +428,12 @@ function reply(viaKeyboard = false): void {
os.post({
reply: appearNote.value,
channel: appearNote.value.channel,
- animation: !viaKeyboard,
}).then(() => {
focus();
});
}
-function react(viaKeyboard = false): void {
+function react(): void {
pleaseLogin();
showMovedDialog();
if (appearNote.value.reactionAcceptance === 'likeOnly') {
@@ -528,18 +528,16 @@ function onContextmenu(ev: MouseEvent): void {
}
}
-function showMenu(viaKeyboard = false): void {
+function showMenu(): void {
if (props.mock) {
return;
}
const { menu, cleanup } = getNoteMenu({ note: note.value, translating, translation, isDeleted, currentClip: currentClip?.value });
- os.popupMenu(menu, menuButton.value, {
- viaKeyboard,
- }).then(focus).finally(cleanup);
+ os.popupMenu(menu, menuButton.value).then(focus).finally(cleanup);
}
-async function clip() {
+async function clip(): Promise {
if (props.mock) {
return;
}
@@ -547,7 +545,7 @@ async function clip() {
os.popupMenu(await getNoteClipMenu({ note: note.value, isDeleted, currentClip: currentClip?.value }), clipButton.value).then(focus);
}
-function showRenoteMenu(viaKeyboard = false): void {
+function showRenoteMenu(): void {
if (props.mock) {
return;
}
@@ -572,18 +570,14 @@ function showRenoteMenu(viaKeyboard = false): void {
getCopyNoteLinkMenu(note.value, i18n.ts.copyLinkRenote),
{ type: 'divider' },
getUnrenote(),
- ], renoteTime.value, {
- viaKeyboard: viaKeyboard,
- });
+ ], renoteTime.value);
} else {
os.popupMenu([
getCopyNoteLinkMenu(note.value, i18n.ts.copyLinkRenote),
{ type: 'divider' },
getAbuseNoteMenu(note.value, i18n.ts.reportAbuseRenote),
($i?.isModerator || $i?.isAdmin) ? getUnrenote() : undefined,
- ], renoteTime.value, {
- viaKeyboard: viaKeyboard,
- });
+ ], renoteTime.value);
}
}
@@ -596,11 +590,11 @@ function blur() {
}
function focusBefore() {
- focusPrev(rootEl.value ?? null);
+ focusPrev(rootEl.value);
}
function focusAfter() {
- focusNext(rootEl.value ?? null);
+ focusNext(rootEl.value);
}
function readPromo() {
@@ -638,7 +632,7 @@ function emitUpdReaction(emoji: string, delta: number) {
&:focus-visible {
outline: none;
- &:after {
+ &::after {
content: "";
pointer-events: none;
display: block;
@@ -651,7 +645,7 @@ function emitUpdReaction(emoji: string, delta: number) {
margin: auto;
width: calc(100% - 8px);
height: calc(100% - 8px);
- border: dashed 1px var(--focus);
+ border: dashed 2px var(--focus);
border-radius: var(--radius);
box-sizing: border-box;
}
--
cgit v1.2.3-freya