Merge pull request #1984 from gijigae/fix/japanese-ime-input
Fix Japanese IME input handling for tag, step, and reaction fields
This commit is contained in:
@@ -8,10 +8,21 @@ export default class extends Controller {
|
||||
debounceTimeout: { type: Number, default: 300 }
|
||||
}
|
||||
|
||||
#isComposing = false
|
||||
|
||||
initialize() {
|
||||
this.debouncedSubmit = debounce(this.debouncedSubmit.bind(this), this.debounceTimeoutValue)
|
||||
}
|
||||
|
||||
// IME Composition tracking
|
||||
compositionStart() {
|
||||
this.#isComposing = true
|
||||
}
|
||||
|
||||
compositionEnd() {
|
||||
this.#isComposing = false
|
||||
}
|
||||
|
||||
submit() {
|
||||
this.element.requestSubmit()
|
||||
}
|
||||
@@ -32,6 +43,12 @@ export default class extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
preventComposingSubmit(event) {
|
||||
if (this.#isComposing) {
|
||||
event.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
debouncedSubmit(event) {
|
||||
this.submit(event)
|
||||
}
|
||||
|
||||
@@ -245,6 +245,9 @@ export default class extends Controller {
|
||||
}
|
||||
},
|
||||
Enter(event) {
|
||||
// Skip handling during IME composition (e.g., Japanese input)
|
||||
if (event.isComposing) { return }
|
||||
|
||||
if (event.shiftKey) {
|
||||
this.#toggleCurrentItem(event)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user