kopia lustrzana https://github.com/shoelace-style/shoelace
improve input submit (#988)
add check to input component if japanese character is chosen by pressing enter key and prevent form submitting Co-authored-by: VitaliyMaznyi <vitalii.maznyi@fasterthanlight.me>pull/1005/head
rodzic
5eeb98d39d
commit
58b653f1ae
src/components/input
|
@ -319,7 +319,9 @@ export default class SlInput extends ShoelaceElement {
|
|||
// submitting to allow users to cancel the keydown event if they need to
|
||||
if (event.key === 'Enter' && !hasModifier) {
|
||||
setTimeout(() => {
|
||||
if (!event.defaultPrevented) {
|
||||
// isComposing is true when enter key is pressed while choosing the chinese/japanese/etc character
|
||||
// so this check will prevent form submitting after choosing character by enter key pressing
|
||||
if (!event.defaultPrevented && !event.isComposing) {
|
||||
this.formSubmitController.submit();
|
||||
}
|
||||
});
|
||||
|
|
Ładowanie…
Reference in New Issue