mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
fix(modal): shouldSubmitOnEnter should also dispatch "click:button--primary"
Fixes #1005
This commit is contained in:
parent
84d6778036
commit
2a50134620
1 changed files with 5 additions and 1 deletions
|
@ -55,7 +55,10 @@
|
||||||
/** Set to `true` to disable the primary button */
|
/** Set to `true` to disable the primary button */
|
||||||
export let primaryButtonDisabled = false;
|
export let primaryButtonDisabled = false;
|
||||||
|
|
||||||
/** Set to `true` for the primary button to be triggered when pressing "Enter" */
|
/**
|
||||||
|
* Set to `true` for the "submit" and "click:button--primary" events
|
||||||
|
* to be dispatched when pressing "Enter"
|
||||||
|
*/
|
||||||
export let shouldSubmitOnEnter = true;
|
export let shouldSubmitOnEnter = true;
|
||||||
|
|
||||||
/** Specify the secondary button text */
|
/** Specify the secondary button text */
|
||||||
|
@ -174,6 +177,7 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} else if (shouldSubmitOnEnter && e.key === 'Enter') {
|
} else if (shouldSubmitOnEnter && e.key === 'Enter') {
|
||||||
dispatch('submit');
|
dispatch('submit');
|
||||||
|
dispatch('click:button--primary');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}"
|
}}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue