2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-19 09:50:33 +03:00

Change all keyup events to keydown (#935)

For a few reasons:

- event.preventDefault() for the Enter key (to stop it from submitting
  the form when you select an item) is only effective if it's a keydown
  event.

- Using keydown for up/down navigation means you can hold them down to
  rapidly scroll through a lot of items.

- Keydown events make the UX feel more responsive, and is consistent
  with how most apps/operating systems handle key presses.
This commit is contained in:
Toby Zerner
2019-10-26 06:42:59 +10:30
committed by Jeff Sagal
parent aea81a6f5c
commit ceb42b4950
4 changed files with 11 additions and 22 deletions
+2 -2
View File
@@ -109,14 +109,14 @@ describe("Toggling Dropdown", () => {
expect(spy).toHaveBeenCalled();
});
it("should remove existing search text on escape keyup", () => {
it("should remove existing search text on escape keydown", () => {
const Select = selectWithProps({
value: [{ label: "one" }],
options: [{ label: "one" }]
});
Select.vm.search = "foo";
Select.find('.vs__search').trigger('keyup.esc')
Select.find('.vs__search').trigger('keydown.esc')
expect(Select.vm.search).toEqual("");
});