The existing method for styling the search fields in the header and the same/similar search field styling for the search results page rely on fixed widths, heights and some absolute positioning. I propose we refactor the code in search.css and search-results.css to rely more on our existing use of Flexbox, and to improve the way we apply the hover/focus effect so that it is more tightly styled and for better responsive support.

CommentFileSizeAuthor
#25 interdiff-23-25.txt1.04 KBmarkconroy
#25 2977510-25.patch8.18 KBmarkconroy
#23 interdiff-17-23.txt723 bytesmarkconroy
#23 2977510-23.patch8.18 KBmarkconroy
#19 interdiff-17-19.txt913 byteskjay
#19 drupal_core-umami-search-results-form-2977510-19.patch8.13 KBkjay
#17 Screenshot_2019-03-13 Search for Herbs Site-Install(3).png214.99 KBkjay
#17 Screenshot_2019-03-13 Search for Herbs Site-Install(2).png205.61 KBkjay
#17 Screenshot_2019-03-13 Search for Herbs Site-Install(1).png199.91 KBkjay
#17 Screenshot_2019-03-13 Search for Herbs Site-Install.png187.75 KBkjay
#17 drupal_core-umami-search-results-form-2977510-17.patch8.17 KBkjay
#15 interdiff_13-15.txt3.91 KBshaal
#15 drupal_core-umami-search-results-form-2977510-15.patch8.22 KBshaal
#13 interdiff_9-13.txt651 bytesshaal
#13 drupal_core-umami-search-results-form-2977510-13.patch7.55 KBshaal
#12 umamu-RTL-search-results.png37.63 KBshaal
#9 drupal_core-umami-search-results-form-2977510-9.patch7.45 KBkjay
#7 Search-btn-chrome.jpeg37 KBVidushi Mehta
#5 2977510-5.patch7.79 KBfinnsky
#3 bluish-greenish-border-on-focus.jpeg10.39 KBVidushi Mehta
#3 search-on-medium-large-screen-afterpatch.jpeg43.23 KBVidushi Mehta
#3 search-on-small-screen-afterpatch.jpeg18.13 KBVidushi Mehta
#3 search-on-medium-large-screen-beforepatch.jpeg53.74 KBVidushi Mehta
#3 search-on -small-screen-before-patch.jpeg24.58 KBVidushi Mehta
#2 umami-demo-refactor-search-form-css-2977510-1.patch7.89 KBkjay
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kjay created an issue. See original summary.

kjay’s picture

Here'e a patch for review that has been tested across current crop of Safari, Chrome, Firefox, IE11 and Edge.

Main points in this patch are:

  1. Switch to fully flexbox layout for both search form instances providing what seems to be a more reliable responsive layout
  2. The form styling options are pretty limited for the Search Results page since Drupal doesn't provide wrappers on the form elements for us to target with styles. By hiding the search results page form label, this patch styles the field to look pretty much identical to the header instance (including adding placeholder text for consistency) and means it is possible to style the form with flexbox for layout.
  3. This patch currently does not limit the width of the header search form (limited to 20em originally), it may be desirable to include this limit?
  4. This patch reveals what might be an important weakness in the current header theming since the container for the form and the container for the user menu (both have border bottom) must be the same height in order for the bottom border to align horizontally. I believe this will need to be a separate issue and propose it's discussed in the next weekly OOTB call since this ties in with improvements we could make to source code order and responsive behaviour.
  5. Existing Umami theme code targets an id (#edit-basic) in search-results.css because it has little choice not to (I believe), is this to be avoided?
Vidushi Mehta’s picture

Hi @kjay

Reviewed your patch and the use of flexbox for consistency looks good on search. Placeholder is visible this time on all screen size. Just noticed one thing on focus of search input there's a bluish-greenish border and before it was not there so I think we should remove the outline from focus so that the greenish border on focus looks more good like before. Adding screenshots of before and after.

markconroy’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Hi @kjay,

It looks like this patch needs a reroll after the patch if IE11 support was committed today.

The code looks good on first inspection, so it shouldn't be a huge amount of work for us to get this committed.

finnsky’s picture

Status: Needs work » Needs review
FileSize
7.79 KB

Hi! rerolled patch.
had one conflict in blocks/search/search.css

<<<<<<< HEAD
  color: #464646;
}

.form-search:focus {
  outline: none;
  margin: 0 0 -2px -2px;
  padding: 5px 8px 5px 32px;
}

=======
  background-size: 1.5em;
  background-color: rgba(255,255,255,0.5);
}
>>>>>>> Applying patch from issue 2977510 comment 12640958
.form-search::placeholder {
  opacity: 1;
}

conflict resolved.

jofitz’s picture

Assigned: kjay » Unassigned
Issue tags: -Needs reroll

Removed tag. Unassigned so that someone can review.

Vidushi Mehta’s picture

FileSize
37 KB

#5 looks good but that bluish-greenish border issue still there but this time on search button and only on chrome and before it was on search input which I had mentioned in #3. Added a screenshot after patch.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kjay’s picture

Attached is a patch that refactors the search form in general to have it follow our global form styles and not the pre-header search form styles. This patch also addresses the responsive theming for the advanced form fields that are provided by the search results page when logged in.

This patch needs work, especially around layout. Having just updated it to work against the latest 8.7.x, I've had to add in a box-sizing: border-box; in search-results.css line 60 which does not seem right. We may need to review our base.css settings for border box methods in general for Umami.

Also - not tested in RTL

Eli-T’s picture

markconroy’s picture

I removed the `box-sizing: border-box;` from the patch and it seems to work fine. It used the border-box from the base.css file, which is correct.

Would be nice to see a new patch with that removed please.

shaal’s picture

FileSize
37.63 KB

The patch on #9 works well with RTL, with one caveat - the pager at the bottom.
umamu-RTL-search-results

By adding this code it fixes it for RTL (and not breaking anything on LTR)

.pager__items {
  display: flex;
  justify-content: center;
}
shaal’s picture

Status: Needs work » Needs review
FileSize
7.55 KB
651 bytes

I added 2 fixes to patch #9:

  • fix for RTL search results' pager
  • removed box-sizing: border-box; (per @markconroy request)
kjay’s picture

I'm not sure why but the border-box issue is in Safari only and does still seem to be an issue. Without box-sizing: border-box;, the columns wrap in Safari.

shaal’s picture

I made some additional updates to the patch.
I tested that it works correctly on Safari 9.1

Main changes included in this patch (based on #13)

  • Various RTL issues fixed
  • Flex not wrapping correctly on Safari
  • Restored box-sizing rule
  • Moving margin to .region-content, instead of margins for each inner element

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kjay’s picture

The patch required a re-roll and two minor tweaks:

  • Re-rolling the patch resulted in a class containing only a commented border, removed this class
  • -1rem margin was applied to the details wrapper for the advanced search resulting in no padding for the three fieldsets, this was removed

Screenshots attached of result. I think this is ready to go.

markconroy’s picture

@kjay

This patch is brilliant. I'm annoyed we've left the search results looking so bad for so long and great that we finally have it this good. Thanks so much.

I'm proposing 2 tiny changes. If you can make those, I'll mark it RTBC then.

  1. +++ b/core/profiles/demo_umami/themes/umami/css/components/blocks/search/search-results.css
    @@ -3,106 +3,129 @@
    +.search-form + .item-list > h3 {
    

    Can we change this from an element to a class? Like this:
    .search-form + .item-list > .search-result__title

  2. +++ b/core/profiles/demo_umami/themes/umami/css/components/blocks/search/search-results.css
    @@ -3,106 +3,129 @@
     .search-results li {
    

    Let's be a little less generic here, incase there is a list within the search result node itself. I suggest:
    .search-results > li
    and the same for the [dir=rtl] following it.

kjay’s picture

@markconroy, thanks for the review! Agreed, we really need to get this one over the line.

I've taken a look at the two issues you raised and the first one is actually a class removal that's required, .search-form + .item-list > h3 doesn't seem to target anything from what I can see. h3 is never going to be the first child of the .item-list UL. Unless you think this should be there for another purpose?

The second is sorted also in the attached patch.

markconroy’s picture

Status: Needs review » Reviewed & tested by the community

Looks like we're ready for RTBC.

Gábor Hojtsy’s picture

Title: Refactor/improve Umami demo's search form CSS » Refactor/improve Umami demo's search form CSS for better responsive support
Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

From stylelint (while attempting to commit):

core/profiles/demo_umami/themes/umami/css/components/blocks/search/search-results.css
 16:1  ✖  Expected empty line before at-rule   at-rule-empty-line-before
 38:1  ✖  Expected empty line before at-rule   at-rule-empty-line-before
markconroy’s picture

Status: Needs work » Needs review
FileSize
8.18 KB
723 bytes

Adding new patch - no changes except adding a blank line before the @ statements.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

I don't know why this was not reported earlier, but there you go:

core/profiles/demo_umami/themes/umami/css/components/blocks/search/search-results.css
 43:1  ✖  Expected empty line before at-rule   at-rule-empty-line-before
markconroy’s picture

Status: Needs work » Needs review
FileSize
8.18 KB
1.04 KB

New patch to add new line to stop the linter failing.

I ran the linter as well, and no new CSS bugs were picked up.

markconroy’s picture

Status: Needs review » Reviewed & tested by the community

Setting to rtbc again as tests have passed.

  • Gábor Hojtsy committed 26918ae on 8.8.x
    Issue #2977510 by kjay, shaal, markconroy, finnsky, Vidushi Mehta, Eli-T...

  • Gábor Hojtsy committed 8e162d6 on 8.7.x
    Issue #2977510 by kjay, shaal, markconroy, finnsky, Vidushi Mehta, Eli-T...
Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks a lot!

Gábor Hojtsy’s picture

Version: 8.8.x-dev » 8.7.x-dev

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.