From 8936faa8c28f98a27555f11092fbdeb0873b8a00 Mon Sep 17 00:00:00 2001 From: Parthiv Krishnan Date: Thu, 22 May 2025 16:28:24 -0400 Subject: [PATCH 1/5] fix: added resultsCountContext prop to pass into the screenReaderText prop --- package.json | 3 +++ .../src/components/SearchInput/SearchInput.tsx | 9 ++++++++- yarn.lock | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a00c85d12b..80c39e069b5 100644 --- a/package.json +++ b/package.json @@ -120,5 +120,8 @@ "packages/*", "packages/react-integration/demo-app-ts" ] + }, + "dependencies": { + "@patternfly/react-core": "workspace:^" } } diff --git a/packages/react-core/src/components/SearchInput/SearchInput.tsx b/packages/react-core/src/components/SearchInput/SearchInput.tsx index 034ca70bd64..ce3b7f5e3f6 100644 --- a/packages/react-core/src/components/SearchInput/SearchInput.tsx +++ b/packages/react-core/src/components/SearchInput/SearchInput.tsx @@ -118,6 +118,8 @@ export interface SearchInputProps extends Omit, /** The number of search results returned. Either a total number of results, * or a string representing the current result over the total number of results. i.e. "1 / 5". */ resultsCount?: number | string; + /** A String that will appear after resultsCount to give context for what that value represents */ + resultsCountContext?: string; /** Label for the button which calls the onSearch event handler. */ submitSearchButtonLabel?: string; /** Value of the search input. */ @@ -144,6 +146,7 @@ const SearchInputBase: React.FunctionComponent = ({ onToggleAdvancedSearch, isAdvancedSearchOpen = false, resultsCount, + resultsCountContext = 'results', onNextClick, onPreviousClick, innerRef, @@ -309,7 +312,11 @@ const SearchInputBase: React.FunctionComponent = ({ /> {(renderUtilities || areUtilitiesDisplayed) && ( - {resultsCount && {resultsCount}} + {resultsCount && ( + + {resultsCount} results + + )} {!!onNextClick && !!onPreviousClick && (