Registering for keyboard events on sp-textarea

Hi, all. I’d like to simulate a form submission when the user enters control/command + enter in an sp-textarea. The only event I can get to fire is the onInput event which doesn’t give me access to things like key codes. Does anyone know of a way to do this? (I assume I could switch to a native HTML input, but I’m trying to stick with the Spectrum look and feel.)

Here is a similar topic.
How to know if a dialog is closed with AltKey

As far as I can tell, keydown events are broken. Even using the UI kitchen sink sample plugin, they only fire in the following cases:

Text Areas:

  • Space
  • Backspace

Text Fields:

  • Space
  • Backspace
  • Return

Here’s an example:

It does not appear to be possible to “submit” a form when the user types control/command + enter in a text area. @kerrishotts: Am I missing something?

Thanks,
Christian

I tried it and confirmed that Enter is not triggered by keydown. This may be on purpose, as area text is expected to be typed frequently with Enter. I look forward to other member’s answers.

Not sure what that means, but submit should not be triggered on textarea just with Enter

This isn’t about submit. It’s about keydown. keydown events should fire whenever any key is pressed in a multiline textarea or in a single-line textfield. It’s up to the developer to decide what to do with them (submit or not).

I got confused because of your previous post about submitting :slight_smile: