Skip to content

Expand Search block customization #22071

Closed

Description

@mtias

The search block is currently very rough to use as a design element on a theme or navigation design. It currently renders like this:

image

This block should have some options in its attributes to:

Some of these could be built as variations offered when inserting the block (in the placeholder scope).

Activity

  1. added
    [Block] SearchAffects the Search Block - used to display a search field
    on May 4, 2020
  2. self-assigned this
    on May 5, 2020
  3. mapk commented on May 6, 2020

    @mapk
    Contributor

    I've made a first pass at some iterations. Still working, but wanted to share what I had for today.

    1. I improved the block to match G2 iterations.
    2. Settings:
      a. Show/hide button
      b. Use icon instead of text in button
      c. Place button inside field instead of outside field
      d. Show/hide label
      e. Adjust border radius of field. (I'm thinking the button would inherit the theme styles) Doing this keeps the settings simplified more.
      f. Adjust border color
    3. Block styles:
      a. Default – What you see.
      b. Expanding – A version that expands on focus.

    We can probably add a lot more settings to allow more control, but I'm attempting to start out simple. I'll work on revisions tomorrow.

    Prototype

    https://www.figma.com/proto/TvjAY5aNMMM8boPHPNwGpT/Search-block?node-id=1%3A329&viewport=-973%2C287%2C0.5&scaling=min-zoom

    search-settings

    Mockup

    https://www.figma.com/file/TvjAY5aNMMM8boPHPNwGpT/Search-block?node-id=1%3A329

    default

  4. mtias commented on May 6, 2020

    @mtias
    MemberAuthor

    What elements (if any) do you think could be added to the toolbar?

  5. karmatosed commented on May 6, 2020

    @karmatosed
    Member

    Interesting explorations @mapk. I tend to agree with @mtias that considering what could be added to toolbar might be interesting.

    One thing worth noting is we currently have these:

    origin

    Whilst having uniform interactions is good, I am not convinced if all of these are needed for this block. In my explorations I removed a lot, however, I don't believe that will be the end case so examining each is a good idea.

    1

    In exploring this more, I think with the padding work being done on other blocks we can move that out of any menu, so I dropped that.

    There is prior art for text and background colors, we could just add border to:

    4

    Where we have options like showing button and also an icon, I do wonder if those are style variations? It feels like that could avoid having too many options here. I wonder if by using only style variations and styling in toolbar, could we get all of these options? How many need to still be in sidebar?

    As far as border-radius is concerned, I think exploring what that could be in the toolbar could be interesting. For example, there is a pattern with text/background color to follow. Here is a really rough mock of that potential.

    radius

    All of these aren't complete, but hopefully, they add some fuel to your mocks for the next iteration phase.

  6. mtias commented on May 6, 2020

    @mtias
    MemberAuthor

    These are not rich-text inline options, they should not show up in the dropdown arrow but in the main toolbar, before "bold" etc.

  7. iamtakashi commented on May 6, 2020

    @iamtakashi

    Some sketches to illustrate what the user might want to achieve:

    Search Patterns

    As @mtias mentioned above, it's often to see a search in a full or partial overlay that appears by clicking an icon. I tried to illustrate an example with below.

    Frame 1

  8. karmatosed commented on May 6, 2020

    @karmatosed
    Member

    An iteration with the note on text tools. I did move out the background / text color as it now has border combined. Again, the icons and ideas are all fuel over complete.

    Frame 3

  9. tomtev commented on May 6, 2020

    @tomtev

    Love all you have done, but styling should be done by themes or plugins?
    IMO core blocks should only have options like "Show button", "Show label" etc, but styling should be done by themes.

  10. mapk commented on May 7, 2020

    @mapk
    Contributor

    My goal for this block is to achieve common search interfaces without an overwhelming amount of settings. As a Core block, I'd like to keep it somewhat limited and allow detailed styles to be applied by the theme.

    @iamtakashi, your mockups above are beautiful and highlight the many variations of search forms. Thank you! However, I'd like to start out with a simpler set of options like this:

    styles

    These variations alone include a large number of settings already. But ultimately, taking into consideration the issue's outline, we can edit:

    • Border & background colors
    • Border radius
    • Icon or button, or no button
    • Label, placeholder, and button text edits
    • Show or hide label
    • Icon display inside search field
    • [not seen] Search overlay option

    These particular examples do not include settings for:

    • Padding
    • Spacing
    • Border width
    • Text color

    @karmatosed has done some great explorations to bring settings to the block toolbar – Thanks!

    Initially, the complexity of tabs inside the toolbar popover felt too overwhelming, especially when we consider that Border color can include border colors for both the input field and the button. Background color can include background colors for the input field and the button too. And finally, if we choose to allow text color edits, this can include the text color for the label and the button. So quickly these settings multiply. This is why in my note above, I've excluded text color edits for the initial MVP.

    What elements (if any) do you think could be added to the toolbar?

    So now, with all these settings, which do we display in the top toolbar that are both important and easy to interact with?

    My first goto for important and easy settings are:

    • Text or icon button.
    • Placement of button inside or outside of input field.

    Here's where I landed today:

    search

    All of this is experimentation. I'm not quite solid on any of it yet. These can very well just be style variations. I'm still working in the same Figma file.

  11. mtias commented on May 7, 2020

    @mtias
    MemberAuthor

    @tomtev that's generally the case, yes, but note that blocks also need a default in case a theme has not specified styles for a block (particularly for 3rd party blocks). That's why some of these are being defined as attributes of the block with the expectations themes will set the default attributes based on their design requirements. Right now that exists in a theme.scss split file that is opt in through add_theme_support. A larger overview of how all these pieces need to fit in is here: #20331

  12. gibrown commented on May 7, 2020

    @gibrown

    The pattern of using a search icon that then unhides a search box is very common and should be supported by Core. The search box should maybe even default to this behavior when on mobile. 2020 for instance uses this pattern.

    Screen Shot 2020-05-07 at 10 40 57 AM

    Screen Shot 2020-05-07 at 10 41 14 AM

  13. 27 remaining items

  14. apeatling commented on Jan 18, 2022

    @apeatling
    Contributor

    I'm unassigning myself from this, others are welcome to pick up items from the list.

  15. Nixon-Joseph commented on Jul 5, 2022

    @Nixon-Joseph

    Can we also include the ability to add some extra search params? I need to use this, but specified to POST's only. Currently there's no way to do this the way it's set up.

  16. added
    [Type] OverviewComprehensive, high level view of an area of focus often with multiple tracking issues
    CustomizationIssues related to Phase 2: Customization efforts
    on Sep 10, 2022
  17. iamtakashi commented on Oct 18, 2022

    @iamtakashi

    Ability to render search interface as a full-screen overlay (and other treatments).

    It'd be great if we could tackle this item soon. It's a struggle to add a search field in the header in a way that works well with small screens. And this will help a lot.

  18. colorful-tones commented on Oct 24, 2022

    @colorful-tones
    Member

    I'm not entirely a fan of the current toolbar implementation. I recently built a dynamic block with a modal overlay. At first, I overlooked the whole toolbar options because I did not even think to look there for configuration/styling options.

    I would love to see this block get some attention for WP 6.2 or earlier. I just obtained access to the handy WordPress Figma Library and I intend to riff on some ideas based on @javierarce great work.

  19. pkuliga commented on Feb 28, 2024

    @pkuliga

    There is also no control over the space between the input text and the border. This is how it looks on Lettre theme Archive page:

    Screenshot 2024-02-28 at 10 56 07
  20. added
    [Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.
    and removed
    [Type] OverviewComprehensive, high level view of an area of focus often with multiple tracking issues
    on Mar 21, 2024
  21. PradViking commented on Sep 9, 2024

    @PradViking

    Current Search Block behaviour when "Button Only" option is selected breaks the UI/UX. If a website uses "Button Only" option to display just the magnifying glass icon and the user clicks on the button, the search field appears to the left of this button and PUSHES anything left of the search block. This means on desktop if there is minimal distance between navigation menu and the search button, this breaks the UI. And on Mobile/Tablet, this is even more pronounced. When the search text field is displayed on the click of the Search Button, it drops down and creates a new row so to speak below Site logo/Title cos it pushes all blocks to the left and due to lack of space, that entire row/group drops down.

    As an example, this is a simple Header with Site Logo on the left, Nav Menu in the middle and Search Block on the Right with Button Only option chosen. Header has 1 row, which in turn has 2 rows inside. Row 1 has the Site logo and Row 2 has Nav Menu and Search block. On Mobile/Tablet View, when user clicks on the Search button the text field is generated to the left of the button and this pushes the Nav menu to the left and due to Row properties both get pushed down below the Site Logo. This could be solved by opening the Search Text field in an overlay, either in a small Search box or a full overlay like the Nvaigation Menu behaviour on Mobile/Tablet. (some example of search text box opening can be found on themes like "Breadly" or "Orin" among many others.

    Desktop
    Before Clicking Search button
    image

    Upon clicking Search Button
    image

    Mobile/Tablet
    Before Clicking Search button
    image

    Upon clicking Search Button
    image

    Prefered Search Text box behaviour upon Click when "Button Only" option used-
    image

    image

  22. annezazu commented on Sep 10, 2024

    @annezazu
    Contributor

    Quick note that I edited the main issue to share the work that's been done. From the original list, the following remains as of WordPress 6.6.1: Ability to render search interface as a full-screen overlay (and other treatments) & add padding support.

    I imagine this might need a similar approach as the navigation block using a template part to control the overlay: #43852 so connecting those two ideas here for now.

    I'm tempted to close this out and only open issues around these final items but curious to hear from others.

  23. mtias commented on Sep 29, 2024

    @mtias
    MemberAuthor

    Closing this and let's follow up on more granular issues for any further improvements.

  24. moved this from 🔺 Stale to ✅ Done in Design Tools Projecton Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CustomizationIssues related to Phase 2: Customization effortsNeeds Design FeedbackNeeds general design feedback.[Block] SearchAffects the Search Block - used to display a search field[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions