-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor GrepCode-components to new components + panda
- Loading branch information
Showing
9 changed files
with
338 additions
and
262 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
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,17 @@ | ||
/** | ||
* Copyright (c) 2024-present, NDLA. | ||
* | ||
* This source code is licensed under the GPLv3 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
|
||
import { RefObject } from "react"; | ||
|
||
// keyboard scrolling does not work properly when items are not nested directly within | ||
// ComboboxContent, so we need to provide a custom scroll function | ||
// TODO: Check if ark provides a better fix for this. | ||
export const scrollToIndexFn = (contentRef: RefObject<HTMLDivElement>, index: number) => { | ||
const el = contentRef.current?.querySelectorAll(`[role='option']`)[index]; | ||
el?.scrollIntoView({ behavior: "auto", block: "nearest" }); | ||
}; |
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
Oops, something went wrong.