Skip to content

Commit 702415a

Browse files
Text hint fix (#838)
* 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
1 parent bd0fd68 commit 702415a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: src/components/Hint/Hint.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@ function copyStyles(inputNode: HTMLInputElement, hintNode: HTMLInputElement) {
3939

4040
export const useHint = () => {
4141
const { hintText, inputNode } = useTypeaheadContext();
42+
4243
const hintRef = useRef<HTMLInputElement | null>(null);
4344

45+
// scroll hint input when the text input is scrolling
46+
inputNode?.addEventListener("scroll", () => {
47+
hintRef.current!.scrollLeft = inputNode?.scrollLeft
48+
})
49+
4450
useEffect(() => {
4551
if (inputNode && hintRef.current) {
4652
copyStyles(inputNode, hintRef.current);

0 commit comments

Comments
 (0)