mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
ignore modifier keys when pressing enter
This commit is contained in:
@@ -259,8 +259,10 @@ export default class SlInput extends LitElement {
|
||||
}
|
||||
|
||||
handleKeyDown(event: KeyboardEvent) {
|
||||
const hasModifier = event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
||||
|
||||
// Pressing enter when focused on an input should submit the form like a native input
|
||||
if (event.key === 'Enter') {
|
||||
if (event.key === 'Enter' && !hasModifier) {
|
||||
this.formSubmitController.submit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user