You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use a Chinese input method (ex: fcitx5-chewing in my case)
Type some Chinese characters in the text area Add a task to "My Calendar"…
Hit Enter
Expected behavior
Currently typed characters are commited when I hit Enter. At this time Nextcloud sees newly typed characters, while the new task should not be created yet, as the Enter key is for the input method, not for the application (the browser running Nextcloud in this case). The new task is created only when I hit Enter for the second time.
See "Additional info" below for how Chinese input methods work.
Actual behaviour
When Enter is hit for the first time, the new task is created.
Tasks app version
0.16.0
CalDAV-clients used
DAVx5
Browser
Firefox 125.0.3
Client operating system
Either Arch Linux or Windows 10
Server operating system
Arch Linux
Web server
Nginx
Database engine version
PostgreSQL
PHP engine version
PHP 8.2
Nextcloud version
28.0.4
Updated from an older installed version or fresh install
In some Chinese input methods, there is a concept called "pre-editing". When some characters are typed, they are placed in a preedit buffer (often decorated with an underline or a dashed underline) until Enter is hit, so that users can modify typed characters. When Enter is hit, characters in the preedit buffer are "committed" and finalized. On the other hand, if ESC is hit before characters are commited, they are discarded. There is a video showing how pre-editing works: https://www.youtube.com/watch?v=5eFTfC8i_gc&t=118s
The issue is reproducible with fcitx5-chewing / Firefox / Arch Linux as well as PIME / Firefox / Windows.
Possible fix
diff --git a/src/components/HeaderBar.vue b/src/components/HeaderBar.vue
index 7fb4a2f2..5cda6333 100644
--- a/src/components/HeaderBar.vue+++ b/src/components/HeaderBar.vue@@ -32,8 +32,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
:show-trailing-button="newTaskName !== ''"
:trailing-button-label="placeholder"
@trailing-button-click="addTask"
- @keyup.esc="clearNewTask($event)"- @keyup.enter="addTask"+ @compositionstart="compositionstart($event)"+ @compositionend="compositionend($event)"+ @keydown.esc="clearNewTask($event)"+ @keydown.enter="addTask"
@paste.stop="addMultipleTasks">
<template #icon>
<Plus :size="20" />
@@ -82,6 +84,7 @@ export default {
showCreateMultipleTasksModal: false,
multipleTasks: { numberOfTasks: 0, tasks: {} },
additionalTaskProperties: {},
+ compositing: false,
}
},
computed: {
@@ -111,12 +114,31 @@ export default {
'createTask',
]),
+ compositionstart($event) {+ this.compositing = true;+ console.log(`compositionstart: this.compositing = ${this.compositing}`);+ },+ compositionend($event) {+ this.compositing = false;+ console.log(`compositionend: this.compositing = ${this.compositing}`);+ },+
clearNewTask(event) {
+ console.log(`clearNewTask: this.compositing = ${this.compositing}`);+ if (this.compositing) {+ return;+ }+
event.target.blur()
this.newTaskName = ''
},
async addTask() {
+ console.log(`addTask: this.compositing = ${this.compositing}`);+ if (this.compositing) {+ return;+ }+
const data = {
summary: this.newTaskName,
// If the task is created in the calendar view,
Browsers send events compositionstart and compositionend when an input method starts/ends a composition session (where users type and optionally modify characters in the pre-editing buffer), respectively. If I skip key events when a composition session is running, special keys like Enter and ESC will only be handled by the input method, not by Nextcloud. Note that I changed keyup to keydown, as when the keyup event is fired, the key is already processed by the input method, and thus the key will be processed again by Nextcloud, which is not desired.
Steps to reproduce
Add a task to "My Calendar"…
Expected behavior
Currently typed characters are commited when I hit Enter. At this time Nextcloud sees newly typed characters, while the new task should not be created yet, as the Enter key is for the input method, not for the application (the browser running Nextcloud in this case). The new task is created only when I hit Enter for the second time.
See "Additional info" below for how Chinese input methods work.
Actual behaviour
When Enter is hit for the first time, the new task is created.
Tasks app version
0.16.0
CalDAV-clients used
DAVx5
Browser
Firefox 125.0.3
Client operating system
Either Arch Linux or Windows 10
Server operating system
Arch Linux
Web server
Nginx
Database engine version
PostgreSQL
PHP engine version
PHP 8.2
Nextcloud version
28.0.4
Updated from an older installed version or fresh install
Updated from an older version
List of activated apps
Nextcloud configuration
Web server error log
Log file
Browser log
Additional info
Backgrounds about Chinese input methods
In some Chinese input methods, there is a concept called "pre-editing". When some characters are typed, they are placed in a preedit buffer (often decorated with an underline or a dashed underline) until Enter is hit, so that users can modify typed characters. When Enter is hit, characters in the preedit buffer are "committed" and finalized. On the other hand, if ESC is hit before characters are commited, they are discarded. There is a video showing how pre-editing works: https://www.youtube.com/watch?v=5eFTfC8i_gc&t=118s
The issue is reproducible with fcitx5-chewing / Firefox / Arch Linux as well as PIME / Firefox / Windows.
Possible fix
Browsers send events
compositionstart
andcompositionend
when an input method starts/ends a composition session (where users type and optionally modify characters in the pre-editing buffer), respectively. If I skip key events when a composition session is running, special keys like Enter and ESC will only be handled by the input method, not by Nextcloud. Note that I changedkeyup
tokeydown
, as when the keyup event is fired, the key is already processed by the input method, and thus the key will be processed again by Nextcloud, which is not desired.Some frontend frameworks handle composition events automatically. For example, the input method works as expected in Syncthing, which seems using Angular 1.x, where compositionstart/compositionend events are handled internally and events are skipped during a composition session. On the other hand, Vue.js also records composition sessions. However, apparently only the text changing events are skipped.
The text was updated successfully, but these errors were encountered: