-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/combobox pageup and pagedown (#3158)
* Add support for PageUp and PageDown in Combobox.FilteredOptions * Remove console.log statements * Add test for PageDown/PageUp * Open FilteredOptions when pressing PageDown * Prevent scrolling from moving the whole page * Consistently scroll to the active element in useVirtualFocus by using useLayoutEffect It seems like doing it with the state update sometimes encounters a race condition preventing the scrolling. This removes the need for a private function handling index update and scrolling, simplifying the code. * Updated test to fit new options order * Prevent "Home" and "End" in Combobox from scrolling as well * Add changeset * Update @navikt/core/react/src/form/combobox/FilteredOptions/useVirtualFocus.ts Co-authored-by: Ken <[email protected]> * useEffect seems to work the same way, and works better for SSR * Removed code that did nothing * Added the same check we have for PageDown, etc. Unsure if it is neccessary. * Change behaviour for "Home" to move focus to the first element instead of Input * Once we changed virtualFocus.moveFocusToTop to move focus to first element instead of the Input, we now need another function to move it to the Input where applicable. * Update .changeset/tasty-cats-hear.md Co-authored-by: Ken <[email protected]> --------- Co-authored-by: Ken <[email protected]>
- Loading branch information
Showing
6 changed files
with
105 additions
and
22 deletions.
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,6 @@ | ||
--- | ||
"@navikt/ds-react": patch | ||
"@navikt/ds-css": patch | ||
--- | ||
|
||
Combobox: Support PageUp/PageDown in dropdown list. |
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
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