diff --git a/CHANGELOG.md b/CHANGELOG.md
index 04ae102227c0..fe9832f7d7f5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/751)
- Enhance: ドライブでソートができるように
- Fix: 通知の範囲指定の設定項目が必要ない通知設定でも範囲指定の設定がでている問題を修正
+- Enhance: 投稿フォームでEscキーを押したときIME入力中ならフォームを閉じないように( #10866 )
### Server
-
diff --git a/packages/frontend/src/components/MkPostForm.vue b/packages/frontend/src/components/MkPostForm.vue
index 76a6e4212a82..b6b80082d3a0 100644
--- a/packages/frontend/src/components/MkPostForm.vue
+++ b/packages/frontend/src/components/MkPostForm.vue
@@ -65,10 +65,10 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.notSpecifiedMentionWarning }} -
-
+
-
+
{{ maxTextLength - textLength }}
@@ -201,6 +201,7 @@ const recentHashtags = ref(JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]'
const imeText = ref('');
const showingOptions = ref(false);
const textAreaReadOnly = ref(false);
+const justEndedComposition = ref(false);
const draftKey = computed((): string => {
let key = props.channel ? `channel:${props.channel.id}` : '';
@@ -573,7 +574,13 @@ function clear() {
function onKeydown(ev: KeyboardEvent) {
if (ev.key === 'Enter' && (ev.ctrlKey || ev.metaKey) && canPost.value) post();
- if (ev.key === 'Escape') emit('esc');
+ // justEndedComposition.value is for Safari, which keyDown occurs after compositionend.
+ // ev.isComposing is for another browsers.
+ if (ev.key === 'Escape' && !justEndedComposition.value && !ev.isComposing) emit('esc');
+}
+
+function onKeyup(ev: KeyboardEvent) {
+ justEndedComposition.value = false;
}
function onCompositionUpdate(ev: CompositionEvent) {
@@ -582,6 +589,7 @@ function onCompositionUpdate(ev: CompositionEvent) {
function onCompositionEnd(ev: CompositionEvent) {
imeText.value = '';
+ justEndedComposition.value = true;
}
async function onPaste(ev: ClipboardEvent) {