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

Add Searchbar Pattern/Block Styles #25

Merged
merged 10 commits into from
Oct 28, 2022
Merged

Conversation

StevenDufresne
Copy link
Collaborator

@StevenDufresne StevenDufresne commented Oct 26, 2022

This PR adds a pattern for the search bar which extends core/search with block styles. This PR also introduces a style component that imports a style sheet the same way we do in wporg-main-2022. See this pull request for background info.

To be honest, this is the first time I have created block styles and I'm okay if there's a better theme.json way of doing it and I have to backtrack a bit. I had to use a lot of !important declarations to fight specificity. I'm wondering if that's the result of this being the wrong approach.

Additionally, I called this the secondary search bar because based on history, there is usually a large one that is included in the header. This search bar style seems to be only used in archive-like scenarios.

See: #9

Variations

Note: Disregard the placeholder "Search Patterns". Updated the placeholder after the screenshots. 😆

Label, Button Inside, Icon This variation is currently in the designs.
Screen Shot 2022-10-26 at 3 14 48 PM

Label, Button Inside, Text
Screen Shot 2022-10-26 at 3 14 36 PM

Label, Button Outside, Icon
Screen Shot 2022-10-26 at 3 14 01 PM

Label, Button Outside, Text
Screen Shot 2022-10-26 at 3 14 09 PM

@ryelle
Copy link
Contributor

ryelle commented Oct 27, 2022

To be honest, this is the first time I have created block styles and I'm okay if there's a better theme.json way of doing it and I have to backtrack a bit. I had to use a lot of !important declarations to fight specificity. I'm wondering if that's the result of this being the wrong approach.

Unfortunately there isn't a theme.json-y way of working with block styles, so what you've got is probably the best even with all the importants.

A scan of the code looks good, but I don't have a local env for showcase right now, so I'll leave the detailed review for someone else :)

@adamwoodnz
Copy link
Contributor

Lacking experience here but yeah the swath of !importants certainly seems like a code smell. Sounds like it can't be helped but maybe something worth raising with Gutenberg folks?

From an a11y standpoint might be worth reviewing whether placeholder is necessary. Some recent feedback on Learn suggested it was too verbose: https://wordpress.slack.com/archives/C02RP4X03/p1663279430556099

Same as @ryelle with the local env, maybe @renintw can run it?

@StevenDufresne
Copy link
Collaborator Author

From an a11y standpoint might be worth reviewing whether placeholder is necessary. Some recent feedback on Learn suggested it was too verbose: https://wordpress.slack.com/archives/C02RP4X03/p1663279430556099

The latest designs remove the label so I'll turn it off.

@StevenDufresne StevenDufresne merged commit 0704187 into main Oct 28, 2022

?>

<!-- wp:search {"showLabel":false,"placeholder":"<?php esc_attr_e( 'Search sites...', 'wporg' ); ?>","width":100,"widthUnit":"%","buttonText":"Search","buttonPosition":"button-inside","buttonUseIcon":true,"className":"is-style-secondary-search-control"} /-->
Copy link
Contributor

Choose a reason for hiding this comment

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

"showLabel":false hides the label visually, but it's still there in the content (using the default label, "Search"), so the feedback about the overly verbose placeholder from here still applies.

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 should have verified. Thanks.

@StevenDufresne
Copy link
Collaborator Author

Opened issue specific to redundant voice over:
WordPress/wporg-parent-2021#62

@ryelle ryelle deleted the add/searchbar-pattern branch November 22, 2022 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants