From 676e95dd0a2f2314da6e687c859927d005bb1b42 Mon Sep 17 00:00:00 2001 From: Vilde Roksand Fauchald Date: Thu, 25 Jan 2024 13:04:53 +0100 Subject: [PATCH 1/2] expose role variable so its possible to change it --- @navikt/core/react/src/form/search/Search.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/@navikt/core/react/src/form/search/Search.tsx b/@navikt/core/react/src/form/search/Search.tsx index 7e4c359c19..8924f9ee12 100644 --- a/@navikt/core/react/src/form/search/Search.tsx +++ b/@navikt/core/react/src/form/search/Search.tsx @@ -66,6 +66,10 @@ export interface SearchProps * Exposes the HTML size attribute */ htmlSize?: number | string; + /* + * Exposes role attribute + */ + role?: string } interface SearchComponent @@ -114,6 +118,7 @@ export const Search = forwardRef( onChange, onSearchClick, htmlSize, + role, ...rest } = props; @@ -205,7 +210,7 @@ export const Search = forwardRef( value={value ?? internalValue} onChange={(e) => handleChange(e.target.value)} type="search" - role="searchbox" + role={role ?? 'searchbox'} className={cl( className, "navds-search__input", From 51585262ed0f286193f3afd5efc3b0b8c3c65f21 Mon Sep 17 00:00:00 2001 From: Vilde Roksand Fauchald Date: Mon, 29 Jan 2024 12:53:28 +0100 Subject: [PATCH 2/2] changeset --- .changeset/curvy-eyes-cheat.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/curvy-eyes-cheat.md diff --git a/.changeset/curvy-eyes-cheat.md b/.changeset/curvy-eyes-cheat.md new file mode 100644 index 0000000000..461f04e523 --- /dev/null +++ b/.changeset/curvy-eyes-cheat.md @@ -0,0 +1,5 @@ +--- +"@navikt/ds-react": patch +--- + +Eksponer variabelen "role" i Search-komponenten