Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only e.preventDefault when Dropdown is active #307

Merged
merged 4 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/run-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Run Linter

on:
pull_request:
branches:
- main
branches: [main, develop]

jobs:
linting:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/wcag_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: WCAG tests

on:
pull_request:
branches:
- main
branches: [main, develop]

jobs:
call_wcag_test:
Expand Down
8 changes: 4 additions & 4 deletions src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ export function Dropdown(props: PropsWithChildren<DropdownProps>): JSX.Element {
}, { disabled: !isActive });

useGlobalListener('keydown', e => {
nmanu1 marked this conversation as resolved.
Show resolved Hide resolved
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
e.preventDefault();
}

if (!isActive) {
return;
}

if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
e.preventDefault();
}

if (e.key === 'ArrowDown') {
if (alwaysSelectOption && focusedIndex === items.length - 1) {
updateFocusedItem(0);
Expand Down
8 changes: 4 additions & 4 deletions test-site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.