mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
send the event target when dispatching submit from enter
This commit is contained in:
parent
08076fbefd
commit
69cb412c34
1 changed files with 3 additions and 2 deletions
|
@ -107,12 +107,13 @@
|
||||||
class:bx--modal--danger="{danger}"
|
class:bx--modal--danger="{danger}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:keydown
|
on:keydown
|
||||||
on:keydown="{({ key }) => {
|
on:keydown="{(e) => {
|
||||||
|
let key = e.key
|
||||||
if (open) {
|
if (open) {
|
||||||
if (key === 'Escape') {
|
if (key === 'Escape') {
|
||||||
open = false;
|
open = false;
|
||||||
} else if (shouldSubmitOnEnter && key === 'Enter') {
|
} else if (shouldSubmitOnEnter && key === 'Enter') {
|
||||||
dispatch('submit');
|
dispatch('submit', e.target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}"
|
}}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue