Fix bug where pressing enter on a tag would open the control

pull/146/head
Cory LaViska 2020-07-24 16:57:19 -04:00
rodzic 40976e58fa
commit 79b84cc47e
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -150,8 +150,10 @@ export class Select {
}
handleKeyDown(event: KeyboardEvent) {
// Open the dropdown when enter is pressed
if (!this.isOpen && event.key === 'Enter') {
const target = event.target as HTMLElement;
// Open the dropdown when enter is pressed while the input is focused
if (!this.isOpen && event.key === 'Enter' && target === this.input) {
this.dropdown.show();
event.preventDefault();
return;