-
Notifications
You must be signed in to change notification settings - Fork 4k
RND-7985: accessible search #3637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 960ccc2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
resultsShowing={resultsState.showing} | ||
resultsCount={resultsState.count} | ||
cursor={resultsState.cursor} | ||
controlsId={searchResultsId} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion: I think it could be more readable to keep a resultsState
object throughout instead of spreading it :
resultsShowing={resultsState.showing} | |
resultsCount={resultsState.count} | |
cursor={resultsState.cursor} | |
controlsId={searchResultsId} | |
resultsState={resultsState} | |
controlsId={searchResultsId} |
resultsCount: number; | ||
cursor: number | null; | ||
resultsShowing: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up my suggestion above:
resultsCount: number; | |
cursor: number | null; | |
resultsShowing: boolean; | |
resultsState: ResultsState; |
const [resultsState, setResultsState] = React.useState<{ | ||
count: number; | ||
showing: boolean; | ||
cursor: number | null; | ||
}>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following up my suggestion below:
const [resultsState, setResultsState] = React.useState<{ | |
count: number; | |
showing: boolean; | |
cursor: number | null; | |
}>({ | |
const [resultsState, setResultsState] = React.useState<ResultsState>({ |
And the type would live above:
type ResultsState = {
count: number;
showing: boolean;
cursor: number | null;
}
{resultsShowing | ||
? resultsCount > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and :
{resultsShowing | |
? resultsCount > 0 | |
{resultsState.showing | |
? resultsState.count > 0 |
resultsCount, | ||
resultsShowing, | ||
cursor, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resultsCount, | |
resultsShowing, | |
cursor, | |
resultsState |
Fixes some issues around search accessibility: