Skip to content
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

Search: Use search block with icon button #155

Merged
merged 3 commits into from
Feb 14, 2022
Merged

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Feb 11, 2022

Fixes #148, fixes #99, fixes #13. This takes some of the code from #113 to use the search block itself, rather than hard-coding it with the custom HTML. Now the search form is generated by the search block, with the "use button with icon" and "button inside" settings.

The button uses the core icon, which looks the same to me, and fixes the CORS issue. Using the "button inside" format of the search lets us remove some of the button positioning code so that the button is visible again, and can get a proper focus style.

Note that the icon button doesn't currently have an accessible label - there's a PR in progress for that here: WordPress/gutenberg#38136

Before After: News After: Make p2
480-trunk 480-branch-news 480-branch-make
1200-trunk-news 1200-branch-news 1200-branch-make
1200-trunk-news-focus 1200-branch-news-focus 1200-branch-make-focus

The spacing difference on the small make screenshot is because of a gutenberg version difference.

@ryelle ryelle requested review from dd32 and coreymckrill February 11, 2022 22:24
@ryelle ryelle self-assigned this Feb 11, 2022
Copy link
Contributor

@coreymckrill coreymckrill left a comment

Choose a reason for hiding this comment

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

👍 Kudos, this looks like a good, seamless solution. One non-blocking issue I noticed is that because the Search dropdown is treated like a modal, in that you can't scroll down the page while it's open, the scroll bar goes away, which causes a layout jump:

Screen.Capture.on.2022-02-11.at.16-39-09.mp4

@ryelle
Copy link
Contributor Author

ryelle commented Feb 12, 2022

hm, the layout jump isn't great, but it's intentional that you can't scroll, since you can't actually interact with the rest of the page until the modal is closed (because it's functionally a dialog). Is that new to this branch though? the dialog behavior is the same on trunk.

@coreymckrill
Copy link
Contributor

Is that new to this branch though? the dialog behavior is the same on trunk.

Hmm, not new, I guess. I'm seeing it on the production test site as well.

@ryelle ryelle merged commit ee1995d into trunk Feb 14, 2022
@ryelle ryelle deleted the try/search-block-settings branch February 14, 2022 18:18
The search block is inside a navigation submenu, because that provides the exact functionality the design
calls for. It also provides a consistent experience with the primary navigation menu, with respect to
keyboard navigation, ARIA states, etc. It also saves having to write custom code for all the interactions.
-->
Copy link
Member

Choose a reason for hiding this comment

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

Was removing the above comment intentional? It's not related to how the search block was forked, and still seems like helpful documentation to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it was outdated since the submenu wrapper was removed in #119, but I guess it could be referring to the nav wrapper itself? Feel free to put it back, if so.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think it's there to address the confusion over why a search box would be inside a menu.

Copy link
Member

Choose a reason for hiding this comment

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

restored in 1951c16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants