Skip to content

Commit

Permalink
Text hint fix (#838)
Browse files Browse the repository at this point in the history
* Long option causes menu to open in wrong position issue
* Fixed long input text doesn't line up with hint issue
* deleted unnecessary changes
* added comments
* updated empty line
  • Loading branch information
Nathan-Roberts123 authored Nov 28, 2024
1 parent bd0fd68 commit 702415a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Hint/Hint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ function copyStyles(inputNode: HTMLInputElement, hintNode: HTMLInputElement) {

export const useHint = () => {
const { hintText, inputNode } = useTypeaheadContext();

const hintRef = useRef<HTMLInputElement | null>(null);

// scroll hint input when the text input is scrolling
inputNode?.addEventListener("scroll", () => {
hintRef.current!.scrollLeft = inputNode?.scrollLeft
})

useEffect(() => {
if (inputNode && hintRef.current) {
copyStyles(inputNode, hintRef.current);
Expand Down

0 comments on commit 702415a

Please sign in to comment.