mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
fix can't open dropdown with keyboard (#610)
This commit is contained in:
parent
93f14c92e4
commit
b810404afa
1 changed files with 5 additions and 1 deletions
|
@ -203,7 +203,11 @@
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
role="button"
|
role="button"
|
||||||
aria-expanded="{open}"
|
aria-expanded="{open}"
|
||||||
on:keydown="{({ key }) => {
|
on:keydown="{(e) => {
|
||||||
|
const { key } = e;
|
||||||
|
if (['Enter', 'ArrowDown', 'ArrowUp'].includes(key)) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
if (key === 'Enter') {
|
if (key === 'Enter') {
|
||||||
open = !open;
|
open = !open;
|
||||||
if (highlightedIndex > -1 && highlightedIndex !== selectedIndex) {
|
if (highlightedIndex > -1 && highlightedIndex !== selectedIndex) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue