atom / atom

:atom: The hackable text editor
https://atom.io
MIT License
60.23k stars 17.39k forks source link

New package input text field backspace and arrow keys #16163

Closed 6112115 closed 6 years ago

6112115 commented 6 years ago

Prerequisites

Description

Steps to Reproduce

I generated a new package. I then added a text field to the view. Using the focus() function, I am able to get the user focused to the text field. The text field does not allow backspace, arrow keys, or delete. Only characters, and home and end seem to work. Its like the text fields are only half focused.

Here are the text fields in the constructor from the view created by the generator:

  constructor(serializedState) {
    // Create root element
    this.element = document.createElement('div');
    this.element.classList.add('pronto-4gl');

    this.textField = document.createElement("input"); //New
    this.textField.type = "text"; //New
    this.textField2 = document.createElement("input"); //New
    this.textField2.type = "text"; //New

       // Create message element
       const message = document.createElement('div');
       message.textContent = 'The Pronto4gl package is Alive! It\'s ALIVE!';
        message.classList.add('message');
        this.element.appendChild(message);
    this.element.appendChild(this.textField); //New
    this.element.appendChild(this.textField2); //New
  }

Here is the toggle function in the main javascript file in lib changed to be an if statement with the focus function:

toggle() {
    console.log('Pronto4gl was toggled!');
      if (this.modalPanel.isVisible()) {
          this.modalPanel.hide();
      } else {
          this.modalPanel.show();
          this.pronto4glView.textField.focus(); //New focus function
      }
  }

Expected behavior: Expecting to be able to use backspace and arrow keys in a text field

Reproduces how often: Every time

Versions

Windows 10. Atom : 1.22.0 Electron: 1.6.15 Chrome : 56.0.2924.87 Node : 7.4.0

winstliu commented 6 years ago

See the Flight Manual section on native key bindings: https://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/#forcing-chromiums-native-keystroke-handling

Because we treat our issues list as the Atom team's backlog, we close issues that are questions since they don't represent a task needing to be completed. For most questions about Atom there are a lot of options, check out:

On Discuss and in the Atom Slack team, there are a bunch of helpful community members that should be willing to point you in the right direction.

lock[bot] commented 6 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!