LearnNewsExamplesServices
Frontmatter
id1729
titleform.field.Text: it is not possible to use arrow keys (left & right) to change the cursor position
stateClosed
labels
bug
assigneestobiu
createdAtApr 6, 2021, 8:18 PM
updatedAtApr 6, 2021, 8:22 PM
githubUrlhttps://github.com/neomjs/neo/issues/1729
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 6, 2021, 8:22 PM

form.field.Text: it is not possible to use arrow keys (left & right) to change the cursor position

Closed v8.1.0 bug
tobiu
tobiu commented on Apr 6, 2021, 8:18 PM

this is related to main.DomEvents:

/**
 *
 * @param {Object} event
 */
onKeyDown(event) {
    this.sendMessageToApp(this.getKeyboardEventData(event));

    if (['ArrowDown', 'ArrowLeft', 'ArrowRight', 'ArrowUp'].includes(event.key)) {
        event.preventDefault();
    }
}

Selection models have pretty bad side effects in case the keydown event is not disabled. The Browser tries to scroll DOM nodes into the visible area in case they receive focus, which is colliding with the internal scroll logic.

If I remember it right, the helix had problems as well.

However, input nodes need the event, otherwise you can not navigate.

I am not 100% sure if we should enable or disable specific targets.

For now, I will enable the keypress default event handling for input fields only. Please add a comment in case we need other targets as well or switch the behavior.

tobiu added the bug label on Apr 6, 2021, 8:18 PM
tobiu assigned to @tobiu on Apr 6, 2021, 8:18 PM
tobiu referenced in commit a242316 - "form.field.Text: it is not possible to use arrow keys (left & right) to change the cursor position #1729" on Apr 6, 2021, 8:20 PM
tobiu closed this issue on Apr 6, 2021, 8:22 PM
tobiu cross-referenced by #5755 on Aug 13, 2024, 10:08 PM