mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
fix(ui-shell): prevent default behavior for Arrow{Up|Down} in HeaderSearch (#432)
This commit is contained in:
parent
95c5682669
commit
e9016a5f8d
1 changed files with 4 additions and 2 deletions
|
@ -223,12 +223,13 @@
|
|||
on:focus
|
||||
on:blur
|
||||
on:keydown
|
||||
on:keydown="{({ key }) => {
|
||||
switch (key) {
|
||||
on:keydown="{(e) => {
|
||||
switch (e.key) {
|
||||
case 'Enter':
|
||||
selectResult();
|
||||
break;
|
||||
case 'ArrowDown':
|
||||
e.preventDefault();
|
||||
if (selectedResultIndex === results.length - 1) {
|
||||
selectedResultIndex = 0;
|
||||
} else {
|
||||
|
@ -236,6 +237,7 @@
|
|||
}
|
||||
break;
|
||||
case 'ArrowUp':
|
||||
e.preventDefault();
|
||||
if (selectedResultIndex === 0) {
|
||||
selectedResultIndex = results.length - 1;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue