-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix/prevent submit on enter in combobox (#2861)
* Prevent "Enter" key in Combobox to... * Added test for Enter not submitting form * Added changeset * Add test for un-selecting a selected option using "enter" on a Chip not submitting the form * Do not prevent enter from submitting form if it should not perform another action (like selecting an option) * Do not submit when the input field has a value * Replace lots of sleep-calls with awaiting userEvents * Create util function for looking up an option * Fix bug where we couldn't un-select a custom option using "enter" * Update test to account for the dropdown list closing when focus moves to the chips in the previous step * Add possibility to slow down tests for debugging * Fix issue with onFocus -> onToggleSelected(false), where clicking the open/close button didn't work * Fix test * Closing the FilteredOptionsList when focusing a Chip caused too many side effects, but we need to remove virtual focus at least. That way we won't double-click on enter. * When no longer closing FilteredOptions on focusing a chip, we don't need to click the toggleIsOpen button to check that the option is un-selected * Update .changeset/rotten-windows-cover.md Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com> --------- Co-authored-by: Ken <26967723+KenAJoh@users.noreply.github.com>
- Loading branch information
Showing
4 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@navikt/ds-react": patch | ||
--- | ||
|
||
Combobox: Prevents "Enter" while Combobox is focused from submitting form. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters