Problem/Motivation

The autocomplete element does not align in views exposed forms:

Steps to reproduce

  1. Install Standard profile
  2. Expose 'field_tags' on /admin/content

Proposed resolution

Align the filters by removing the additional margin from the autocomplete element.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

Autocomplete input in views exposed filters aligns with select and text inputs.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#55 firefox1.png28.36 KBckrina
#48 issue-view.png40.03 KBdjsagar
#48 After-patch.png54.34 KBdjsagar
#46 3116377-after.png23.84 KBAbhijith S
#46 3116377-before.png24.56 KBAbhijith S
#45 autocomplete-message-w-bg.png26.03 KBvolkerk
#45 autocomplete-message.png27.36 KBvolkerk
#44 label-run-into-loading.png13.7 KBjustafish
#42 42--chrome--2.png48.96 KBjustafish
#42 42--chrome--1.png47.43 KBjustafish
#42 42--ie-11--2.png88.29 KBjustafish
#42 42--ie-11--1.png166.73 KBjustafish
#36 Screenshot 2020-06-26 at 12.38.47 PM.png654.76 KBkiran.kadam911
#34 Screen Shot 2020-06-25 at 20.01.10.png25.61 KBlauriii
#33 after.png437.71 KBkiran.kadam911
#33 before.png188.71 KBkiran.kadam911
#31 interdiff_25-31.txt1.08 KBravi.shankar
#31 3116377-31.patch3.06 KBravi.shankar
#27 Before Patch.png105.37 KBpriyanka.sahni
#27 After Patch Mobile.png101.77 KBpriyanka.sahni
#27 After Patch Desktop.png100.43 KBpriyanka.sahni
#25 interdiff_21-25.txt1.12 KBravi.shankar
#25 23116377-25.patch3.06 KBravi.shankar
#22 3116377-lint-error.png15.11 KBIndrajithKB
#21 Screen Shot 2020-06-16 at 10.48.14 PM.png76.7 KBkomalk
#21 interdiff_13-21.txt1.33 KBkomalk
#21 3116377-21.patch3.23 KBkomalk
#20 Screen Shot 2020-06-04 at 16.43.12.png45.92 KBlauriii
#14 selected_8579.png96.45 KBKondratievaS
#13 screenshot-after.png107.76 KBsauravk
#13 3116377-13.patch2.99 KBsauravk
#11 views_filters.png70.05 KBmmd
#9 selected_8369.png77.32 KBKondratievaS
#8 3116377-8.patch1017 bytesswatichouhan012
#2 3116377-2-after.png216.45 KBidebr
#3 selected_0005.jpg106.2 KBKondratievaS
#2 3116377-2.patch1017 bytesidebr
claro-autocomplete-exposed-filters.png203.97 KBidebr

Issue fork drupal-3116377

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr created an issue. See original summary.

idebr’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
216.45 KB
1017 bytes

Attached patch removes the margin from the autocomplete element, so the exposed input elements align horizontally.

Screenshot after:

KondratievaS’s picture

FileSize
106.2 KB

Tested patch from #2 for in Chrome, FF, Safari, IE and result is OK

ok

KondratievaS’s picture

Status: Needs review » Reviewed & tested by the community
jungle’s picture

Status: Reviewed & tested by the community » Needs work

4 coding standards messages

Coding standards check must pass, see https://www.drupal.org/pift-ci-job/1614192

idebr’s picture

Status: Needs work » Reviewed & tested by the community

The coding standards messages are unrelated to this patch. Fixing them here would be scope creep.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 2: 3116377-2.patch, failed testing. View results

swatichouhan012’s picture

Status: Needs work » Needs review
FileSize
1017 bytes

Rerolled patch #2 for test pass

KondratievaS’s picture

FileSize
77.32 KB

I can reproduce issue if field has Help text

bug

KondratievaS’s picture

Status: Needs review » Needs work
mmd’s picture

FileSize
70.05 KB

Also, need to resolve case when the form element has a long description.

sauravk’s picture

Assigned: Unassigned » sauravk
sauravk’s picture

Assigned: sauravk » Unassigned
Status: Needs work » Needs review
FileSize
2.99 KB
107.76 KB
KondratievaS’s picture

FileSize
96.45 KB

Tested patch from #13 in Chrome, FF, IE, Safari for desktop and mobile and result is OK

OK

KondratievaS’s picture

Status: Needs review » Reviewed & tested by the community

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

xjm’s picture

atul4drupal’s picture

patch at #13 worked fine for me. RTBC +1

ckrina’s picture

Status: Reviewed & tested by the community » Needs work

Adding a max-width on bigger screens is really useful, but on the smaller ones doesn't makes sense the fields don't get the full width having enough space. So I'd suggest to add to wrap the max-width value into a media query.

lauriii’s picture

We can certainly add the rule to media query but we don't set the inputs as width 100% at the moment.

I missed that we have that for text inputs but not selects. We should add the rule in a media query like @ckrina suggested.

komalk’s picture

Status: Needs work » Needs review
FileSize
3.23 KB
1.33 KB
76.7 KB

Wrap the max-width value into a media query.
Review the patch attached screen shot for the reference.

IndrajithKB’s picture

FileSize
15.11 KB

Hi @komalkolekar please re-roll the patch. Fix lint error.

lint-error

IndrajithKB’s picture

Status: Needs review » Needs work
ravi.shankar’s picture

Assigned: Unassigned » ravi.shankar

Working on this.

ravi.shankar’s picture

Assigned: ravi.shankar » Unassigned
Status: Needs work » Needs review
FileSize
3.06 KB
1.12 KB

Here I have addressed comment #22.

priyanka.sahni’s picture

Assigned: Unassigned » priyanka.sahni
priyanka.sahni’s picture

Verified and tested by applying the patch #25.It looks good to me.Can be moved to RTBC.

Steps to test-
1. Go to admin site.
2. Go to admin/appearance.
3. Enable the Claro theme.
4. Go to admin/structure/views/view/content.
5. Make changes in View for content type.
6. Verify the content type page.

Before Patch -
BeforePatch

After Patch Desktop -
After Patch

After Patch Mobile -
After Patch

priyanka.sahni’s picture

Assigned: priyanka.sahni » Unassigned
KondratievaS’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs frontend framework manager review

This looks pretty good already! Thank you for working on this!

+++ b/core/themes/claro/css/components/views-exposed-form.pcss.css
@@ -35,6 +34,13 @@
+@media only screen and (min-width: 767px) {

The min-width should probably be 601px because the form elements are set as 100% until max-width: 600px.

ravi.shankar’s picture

Status: Needs work » Needs review
FileSize
3.06 KB
1.08 KB

Here I have tried to address comment #30.

kiran.kadam911’s picture

Assigned: Unassigned » kiran.kadam911
kiran.kadam911’s picture

Hello,

Tested patch #31 which works fine as per previous comment of @lauriii.

Screenshot:
Before:

After:

Thanks!

lauriii’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
FileSize
25.61 KB

This looks great on Chrome and IE 11 but Edge could use some more work still:

kiran.kadam911’s picture

Assigned: Unassigned » kiran.kadam911
kiran.kadam911’s picture

Assigned: kiran.kadam911 » Unassigned
FileSize
654.76 KB

@lauriii I checked the same page on IE Edge v83(browserstack) but not able to reproduce the above alignment issue as per #34

SS:

Thanks!

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

justafish made their first commit to this issue’s fork.

justafish’s picture

Status: Needs work » Needs review
FileSize
166.73 KB
88.29 KB
47.43 KB
48.96 KB

Here's an alternative approach which uses the line height and margins of labels to calculate the missing space

https://git.drupalcode.org/project/drupal/-/merge_requests/131 (also this is my first go switching from patches to merge request, apologies in advance if I've done something wrong in the process here ☺️)

Chrome -
Screenshot of aligned views exposed filter items in Chrome at a small width
Screenshot of aligned views exposed filter items in Chrome at full width

IE11 -
Screenshot of aligned views exposed filter items in IE11 at a small width
Screenshot of aligned views exposed filter items in IE11 at full width

volkerk’s picture

Hi,

I would prefer the patch from #31
because it removes the margins on .claro-autocomplete which gives me trouble in #3194226: Add a form description toggle.
I tested the patch from #31 in edge 84 and edge 88, latest chrome and firefox esr 78 and I cannot seem to be able to reproduce the misalignment issue mentioned in #34, it also does not have the align-items issue in firefox mentioned in the mr.

justafish’s picture

FileSize
13.7 KB

If we remove that margin completely it causes issues elsewhere e.g.
A screenshot of the autocomplete author text input on a node edit page, with the label of the field overlapping the ajax loading label
(not that this looks perfect with the margin, but it's better 😊)

I've updated MR !131 with a fix for Firefox and the autocomplete breaking out of the container between 600px - 769px

volkerk’s picture

Ah, I can see the issue now, this made me think, maybe we could add some background to .claro-autocomplete__message?

Before (with margin):

Autocomplete message overlapping label

No additional margin, white background:

Autocomplete message overlapping label with added background

Btw. is it me or is only half of the throbber visible?

Abhijith S’s picture

FileSize
24.56 KB
23.84 KB

Applied patch #31 and it works fine. Adding screenshots below.

Before patch:

before

After patch:

after

RTBC +1

justafish’s picture

@volkerk That's a nice solution 👍 I think this might be better moved to a separate issue? I'm sure there's a bunch of other places in the UI we'd need to test this change, plus addressing the throbber visibility issue.

djsagar’s picture

Status: Needs review » Needs work
FileSize
54.34 KB
40.03 KB

Hi @volkerk,

Patch #45 is applied and resolved the above issue but these is same issue on view content.
button is does not align with others.

Please have a look on attachment.

Thanks!

justafish’s picture

Status: Needs work » Needs review

@djsagar which patch did you apply and in what browser is that?

lauriii’s picture

I posted some feedback on the MR. I think that approach is good because it's getting closer to solving the root cause of this bug. ✌️

justafish’s picture

@lauriii thanks for the review! The collapsing margin is in place so that autocomplete fields that have no label are also aligned correctly

lauriii’s picture

IIRC the margin was added intentionally to avoid #44. It might make sense to change the margin here, and fix it elsewhere on a follow-up since the problem caused with the loading... in edge cases where the label is very long could be less of a problem than the form elements not being aligned.

However I discovered another problem. If we remove the align-items: flex-end, buttons don't align with form elements without labels. But that doesn't work with descriptions and errors 🤷‍♂️

lauriii’s picture

Issue tags: +Needs change record

Discussed #52 with @justafish yesterday and we found out that the problem was with me testing the change by modifying markup in the chrome developer tools rather than actually changing the Views configuration.

We also did some testing related to the loading text and we discovered some edge cases where the label totally should be still displayed as inline-block. Therefore we agreed to remove the margin-top from the .claro-autocomplete element. We also did some manual testing to ensure it doesn't break any of the other use cases. We tested autocomplete in entity references (tags style and table drags) as well as autocomplete in the entity meta column. We also did some testing before and after and this change doesn't make the loading item look any more awkward with long labels than it already looks.

I think we should open follow-up for addressing #44 still. I also posted some very minor feedback on the MR.

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

All of my points on the MR were addressed. Moving to RTBC. Who wants to create the follow-up?

ckrina’s picture

Issue summary: View changes
FileSize
28.36 KB

I've just created #3199351: Claro: review line-heigh usage accross components to address the line-height feedback.

And, If I’m not missing things, I can see the alignment fixed for autocomplete fields (with and without description) and working well with buttons. Here are the screenshots for Firefox:

And +1 on coming up with a solution for the loading overlapping problem into another issue too.

justafish’s picture

Here's the follow up for the overlapping text https://www.drupal.org/project/drupal/issues/3199601

alexpott’s picture

Version: 9.2.x-dev » 9.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed d9b41a883f to 9.2.x and 6bd92072ad to 9.1.x. Thanks!

Discussed with @lauriii and we agreed to backport to 9.1.x as claro is still experimental.

  • alexpott committed d9b41a8 on 9.2.x
    Issue #3116377 by justafish, ravi.shankar, idebr, komalk, sauravk,...

  • alexpott committed 6bd9207 on 9.1.x
    Issue #3116377 by justafish, ravi.shankar, idebr, komalk, sauravk,...
lauriii’s picture

Issue tags: -Needs change record

Seems like I tagged this accidentally with "Needs change record" when I meant to tag this with "Needs followup". Removing the tag because the follow-up issue has been filed and this doesn't need change record.

Status: Fixed » Closed (fixed)

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