[improvement] check event.cancelable before preventDefault
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { use } from '../utils';
|
||||
import { inherit, emit } from '../utils/functional';
|
||||
import { preventDefault } from '../utils/event';
|
||||
import Field from '../field';
|
||||
|
||||
// Types
|
||||
@@ -70,7 +71,7 @@ function Search(
|
||||
keypress(event: KeyboardEvent) {
|
||||
// press enter
|
||||
if (event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
preventDefault(event);
|
||||
emit(ctx, 'search', props.value);
|
||||
}
|
||||
emit(ctx, 'keypress', event);
|
||||
|
||||
Reference in New Issue
Block a user