Skip to content

chore(site): refactor filter component to be more extendable #13688

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

Merged
merged 16 commits into from
Jul 2, 2024

Conversation

BrunoQuaresma
Copy link
Collaborator

Related to #13035

@BrunoQuaresma BrunoQuaresma self-assigned this Jun 27, 2024
@BrunoQuaresma
Copy link
Collaborator Author

@aslilac @Parkreiner I would appreciate a QA on this too 🙏

@Parkreiner
Copy link
Member

@BrunoQuaresma I'll definitely start the review later today, but just because this is such a core piece of the app, I'm really going to want to take my time with testing it out locally

Might not be able to start that until tomorrow morning, but I'll try to get review and testing wrapped up by EOD tomorrow

Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far!
I'm going to try running this tomorrow morning

Comment on lines 34 to 35
// SelectFilterSearch element
search?: ReactNode;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this prop be renamed to make it more clear that it's meant to be used with SelectFilterSearch? It doesn't feel obvious right now, especially with the comment being a private comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using SelectFilterSearch I feel I have to pass the component and not a React Node 🤔 Maybe selectFilterSearch?

Comment on lines 56 to 57
{selectedOption?.label ?? placeholder}
<span css={{ ...visuallyHidden }}>{label}</span>
Copy link
Member

@Parkreiner Parkreiner Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what you were going for with this? From how I'm reading it, if the selectedOption has a label, then both it and the visually-hidden label in the span will be exposed through the button as an accessible name value. So in that case, a screen-reader user might get double/redundant labels

If it's okay for the main visual label text to be hidden from screen readers, this could be rewritten as

<span aria-hidden>{selectedOption?.label ?? placeholder}</span>

This hides it from screen readers, but keeps the content on the page. Normally this is a really bad idea, but as long as we have the backup label guaranteed to be defined, I think it's okay

Edit: aria-hidden, not hidden

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice it 🤦 My idea is, since this is a select component, I think having a label like "Select a user" is better than having the selected value as the label "User 2" for example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used aria-label in the button directly.

Co-authored-by: Michael Smith <throwawayclover@gmail.com>
@Parkreiner
Copy link
Member

@BrunoQuaresma Ran through and tested everything. Everything seems to work really well. Only noticed one minor quirk when using the menus via keyboard

When the menu opens up, it would be nice if the first element in the menu gets autofocus (for the list-only dropdowns, that would be the first item, but for the search dropdowns, that would be the search box). Without the auto-focus, trying to hit the arrow keys just makes the menu scroll instead of interacting with the elements

Screen.Recording.2024-06-28.at.10.36.47.AM.mov

Even for non-keyboard users, auto-focusing the search field feels like a pretty good UI improvement, because it means one less click that they need to do

Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna go ahead and approve this – the core redesign seems really good, and none of the feedback seems big enough to be worth blocking on

@BrunoQuaresma BrunoQuaresma requested a review from aslilac June 28, 2024 18:49
@BrunoQuaresma
Copy link
Collaborator Author

@Parkreiner I would appreciate a second round of review if possible 🙏 . Related to autofocus, it does not work locally, but to make sure I'm going to test it on a preview deployment. Thanks for the heads up.

@coder coder deleted a comment from github-actions bot Jul 1, 2024
Copy link

github-actions bot commented Jul 1, 2024


🚀 Deploying PR 13688 ...

Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick look over the new files, and the code looks pretty good to me. I know you're using splice now, but it looked like was still using immutable operations, so we're good

Tentatively giving my rubber stamp – not sure if @aslilac wants to kick the tires a bit more?

@BrunoQuaresma
Copy link
Collaborator Author

Looks like preview deployments are broken so I'm going to merge it and test "auto focus" on dogfood.

Copy link
Member

@aslilac aslilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! couple small thoughts

@BrunoQuaresma BrunoQuaresma merged commit 9ee53e5 into main Jul 2, 2024
29 checks passed
@BrunoQuaresma BrunoQuaresma deleted the bq/merge-search-and-search-field branch July 2, 2024 16:15
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants