Input Text Element Can't Backspace


#1

I am using code like below and when I pull it up in dev mode it allows me to type in, but not backspace my input (erase it).

@input type: ‘text’


Backspace not working in TextEditorView
#2

Can you be more specific? I can’t tell if you’re asking for help with writing a package or just the normal usage of the application :smile:


#3

Writing a package. Specifically I am working on the script package below. I also linked my pull request since that is an example of code which generating this problem:



#4

Bump on this, its a showstopper bug right now.

I think perhaps we have narrowed it down to input elements on subviews, but unsure


#5

Please don’t bump topics. Discourse offers the tools for everyone to manage what they read for themselves.


#6

Is the text area in question nested inside an editor? I recommend applying the .native-key-bindings class to text areas and any other kind of element where you expect standard browser behaviors for key bindings. Let me know if that helps.


#7

I was also having problems getting user input. Adding native-key-bindings class solved my backspace keybinding issue.


Why doesn't pressing Enter submit <form>?
Custom form in views with babel
#8

This works great. For the curious devs out there, here’s the source.


#9

.native-key-bindings worked great, but broke tab, now I can not move to the next input by pressing tab. Any ideas?
Thanks,


#10

ok, that might be helpful https://discuss.atom.io/t/backspace-isnt-working-in-regular-text-fields/11020/3


#11

Just putting my solution here in case anyone else comes along with the same problem like me. This adds the tab and enter functionality back into your input elements.

First, put the native-key-bindings class on your inputs to get backspace to work.
<input class="native-key-bindings">

Then, add key listeners to the input.
inputElement.onkeyDown = function(event){ if(event.key === "Tab"){ if(event.shiftKey){ previousInputElement.focus(); }else{ nextInputElement.focus(); } }else if(event.key === "Enter"){ submitForm(); } }