Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nodejs][Keyboard shortcut] Ctrl+Enter not working when inlineAction associated with a text.input #4575

Closed
scottlovegrove opened this issue Aug 12, 2020 · 7 comments · Fixed by #4840
Assignees
Labels
Bug Good First Issue Platform-JavaScript Bugs or features related to the JavaScript renderer
Milestone

Comments

@scottlovegrove
Copy link
Contributor

scottlovegrove commented Aug 12, 2020

Platform

What platform is your issue or question related to? (Delete other platforms).

  • JavaScript

Author or host

Host, using the SDK to render adaptive cards ourselves

SDK version 2.0.0 on npm

Details

When having an inlineAction set against a Text.Input, pressing ctrl+enter with the keyboard when in the input field should trigger the inline action, right now, it is not.

This is seen in Chrome (v84.0.4147.125), haven't tried this in other browsers, but would imagine it's the same.

@ghost ghost added the Triage-Needed label Aug 12, 2020
@scottlovegrove
Copy link
Contributor Author

In my own project, I had to use e.ctrlKey && e.charCode === 13 && this.inlineAction as my condition. I have created a fix for this, but I'm unsure whether to submit because apparently charCode is deprecated and code should be used, but that doesn't appear in my types as an available option 🤷‍♂️

@shalinijoshi19
Copy link
Member

shalinijoshi19 commented Aug 13, 2020

Thanks for raising and proposing the fix. @dclaux/ @paulcam206 thoughts?

@shalinijoshi19 shalinijoshi19 added javascript Platform-JavaScript Bugs or features related to the JavaScript renderer Good First Issue labels Aug 13, 2020
@dclaux
Copy link
Member

dclaux commented Aug 13, 2020

@scottlovegrove I am able to repro this in Firefox, thanks for reporting and for proposing a fix. charCode is non-standard and deprecated though, so we can't use it. But so is keyCode which the code currently uses. The guidance is to use KeyboardEvent.code instead. While it is not supported in IE, I believe it is an OK compromise.

Could you update your change to use KeyboardEvent.code and make sure it works across browsers?

@scottlovegrove
Copy link
Contributor Author

Could you update your change to use KeyboardEvent.code and make sure it works across browsers?

@dclaux The problem I have here is that although the guidance is to use KeyboardEvent.code, I can't actually find any typescript type definitions that include this, so couldn't this end up breaking a build somewhere?

@shalinijoshi19 shalinijoshi19 added this to the 20.09 milestone Sep 21, 2020
@ghost ghost added the AdaptiveCards v20.09 label Sep 21, 2020
@shalinijoshi19
Copy link
Member

@dclaux bringing this up to your attention.

@dclaux
Copy link
Member

dclaux commented Sep 21, 2020

@scottlovegrove not sure what version of TypeScript you're using, but KeyboardEvent.code does show up for me:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Good First Issue Platform-JavaScript Bugs or features related to the JavaScript renderer
Projects
None yet
3 participants