From 5e0678cf7d7d15420068b0c2dc9a4ca0e3b52aa7 Mon Sep 17 00:00:00 2001 From: PelayoFelgueroso Date: Mon, 27 Jul 2026 09:35:47 +0200 Subject: [PATCH 1/2] Fix scrollbar behaviour --- packages/lib/src/text-input/Suggestions.tsx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/packages/lib/src/text-input/Suggestions.tsx b/packages/lib/src/text-input/Suggestions.tsx index 7355ada6f..9fbad145f 100644 --- a/packages/lib/src/text-input/Suggestions.tsx +++ b/packages/lib/src/text-input/Suggestions.tsx @@ -66,7 +66,12 @@ const Suggestions = ({ }, [visualFocusIndex]); return ( - + { + event.preventDefault(); + }} + style={styles} + > {isSearching ? ( {translatedLabels.textInput.searchingMessage} @@ -77,16 +82,7 @@ const Suggestions = ({ {translatedLabels.textInput.fetchingDataErrorMessage} ) : ( -
    { - event.preventDefault(); - }} - ref={listboxRef} - role="listbox" - style={{ margin: 0, padding: 0 }} - > +
      {suggestions.map((suggestion, index) => ( Date: Mon, 27 Jul 2026 09:52:13 +0200 Subject: [PATCH 2/2] add test --- packages/lib/src/text-input/TextInput.test.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/lib/src/text-input/TextInput.test.tsx b/packages/lib/src/text-input/TextInput.test.tsx index c8f234ff4..93b6d5d66 100644 --- a/packages/lib/src/text-input/TextInput.test.tsx +++ b/packages/lib/src/text-input/TextInput.test.tsx @@ -910,6 +910,23 @@ describe("TextInput component synchronous autosuggest tests", () => { expect(list).toBeTruthy(); expect(getAllByText("?").length).toBe(1); }); + + test("Autosuggest scrollbar behaviour", () => { + const onChange = jest.fn(); + const { getByRole, queryByRole } = render( + + ); + const input = getByRole("combobox"); + fireEvent.focus(input); + const list = getByRole("listbox"); + expect(list).toBeTruthy(); + + const suggestionsContainer = list.parentElement; + fireEvent.mouseDown(suggestionsContainer!); + expect(getByRole("listbox")).toBeTruthy(); + fireEvent.blur(input); + expect(queryByRole("listbox")).toBeFalsy(); + }); }); describe("TextInput component asynchronous autosuggest tests", () => {