Problem/Motivation
Container inline is used often to display forms horizontally, but the usecase is so broad, that it's hard to predict how it affects many use cases across core.
Proposed resolution
We added a dedicated classes for displaying forms horizontally in #2333719: Abstract Views Exposed Form styling out into a reusable class. This allows us to target form elements specifically.
Remaining tasks
Find all instances of uses of container-inline to display a form horizontally.
Check if there is any CSS that adds to container-inline for each instance, and assess whether it is needed (consistency FTW)
Replace container-inline with form--inline
Improve form--inline so it can cover all use cases
User interface changes
Maybe some minor spacing changes for consistency.
Test URLS
/admin/config/system/actions
/admin/content/comment
/admin/structure/types/manage/article/fields/node.article.field_image
/admin/config/regional/translate
/admin/config/content/formats/manage/basic_html
/node/add/article -> Insert image
/admin/reports/dblog
/node/add/article -> Date field display
/admin/config/regional/translate
node/%/edit
/node/preview/%/default
/admin/config/system/actions
/admin/content/comment
/admin/structure/types/manage/article/fields/node.article.field_image
/node/add/article (WYSIWYG image editor)
/node/add/%node-with-date-field
/search/node
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#70 | 2417111-nr-bot.txt | 140 bytes | needs-review-queue-bot |
#53 | replace-2417111-53.patch | 17.99 KB | gnuget |
#53 | 2417111-interdiff-52-53.txt | 482 bytes | gnuget |
#40 | replace-container-inline-2417111-40.patch | 17.81 KB | irina.rozite |
#38 | replace-container-inline-2417111-38.patch | 17.3 KB | Manjit.Singh |
Issue fork drupal-2417111
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:
Comments
Comment #1
kyuubi CreditAttribution: kyuubi commentedHappy to start working on this.
Comment #2
kyuubi CreditAttribution: kyuubi commentedHi LewisNyman,
Looking through this issue and form--inline seems to be using float:left rather than display:inline (or inline block).
If we replace the container-inline with this in typical actions/operations forms (eg. comments update options) we are going to have some issues with alignment (see screenshot example). Should work fine with form inputs ofc.
Wouldn't it be preferable to use inline styling for these types of elements?
If not do we prefer to use container-inline for these situations or replace everything with form--inline?
Let me know what the preferred approach is and I will provide a patch for this.
Thanks,
Comment #3
LewisNymanThere must be a reason why it displays differently compared to another inline form, would you mind posting a patch anyway? Then we can figure out if we need to improve the styling to be more complete or if we need to undo/remove some CSS that is being applied here
Comment #4
kyuubi CreditAttribution: kyuubi commentedSure np.
I will patch using all form elements using form--inline (float:left) and we can tackle the ones that break after.
It is actually consistent every form where the float is with a select next to a submit button we have the issue. Form inputs and things like that the form--inline works ok.
I will work on the patch and we will take it from there.
Comment #5
kyuubi CreditAttribution: kyuubi commentedHi LewisNyman,
Attaching a patch for this.
It does not cover all of the instances of container-inline as they are many but it's a starting point.
I'm sure just this will raise a few issues by itself.
A couple of things to note are some paddings included in modules by default that seem to be dependent on the old display-inline style, so I updated them as well. Don't know if it is preferable to update them just in seven but it seems to me that by having specific values like paddings in the base styles will always cause issues like this.
Another thing is the fact that the form--inline style is floated, sometimes affects following elements. An example of this is the image settings in the image field configuration where the descriptions get floated together with the inputs putting the description aside the inputs, which screws up the layout. I have added a clear on the description to fix this for now.
Let me know your comments and I will continue working on the remaining instances meanwhile.
Cheers,
Comment #6
LewisNymanNice! As you said, a big part of the regression here are to do with
container-inline
usingdisplay: inline;
which unset all the margins on those elements. See: #2226317: Divs in the container-inline wrapper should be inline-block instead of inlineI've gone over all the instances, looking for where modules have applied code to achieve their own inline form, and removing them. This should give us a level playing field to see if we can improve
form--inline
to be more robust and work in more situations, or at least make it clear what those situations are.In these instances we are not adding the
form--inline
wrapper to cover all the items we needComment #7
LewisNymanComment #8
kyuubi CreditAttribution: kyuubi commentedUfff...
Okay, we should now have all instances identified and changed :)
From the previous patch I have also reverted style changes in module's CSS as I assume they will be cleaned up in another issue (interdiff attached).
We should be able to have an index of instances from the attached screenshots.
The only exception (not in screens) is one instance in views AddHandler.php. That basically shows a div with the fields you selected to add to a view and it completely breaks after changing the class to form--inline.
This should be a good starting point.
Where do you suggest we go from here?
Comment #9
kyuubi CreditAttribution: kyuubi commentedComment #10
LewisNymanI've added some of the test urls so we can run a visual regression test.
Comment #11
kyuubi CreditAttribution: kyuubi commentedHey,
Here are the remaining urls:
/admin/config/regional/translate
node/%/edit
/node/preview/%/default
/admin/config/system/actions
/admin/content/comment
/admin/structure/types/manage/article/fields/node.article.field_image
/node/add/article (WYSIWYG image editor)
/node/add/%node-with-date-field
What's the next step?
Comment #12
LewisNymanTHanks, I'm going to give this a run through with Backstop.js
Comment #13
LewisNymanRerolled patch
Comment #14
LewisNymanI've attached the BackstopJS report, and the backstop.json config file I used for it.
You can see in the report that there are a few pages where we need to do a little work, in some pages we have actually improved the spacing :)
Comment #15
kyuubi CreditAttribution: kyuubi commentedHi LewisNyman,
Cool stuff :)
Where do you propose we go from here?
Comment #16
LewisNymanHey, sorry I've been busy recently, some of these failed need fixing, some don't
/admin/config/system/actions — Looks different but better
/admin/content/comment — Incorrect spacing on desktop/mobile
/admin/structure/types/manage/article/fields/node.article.field_image — Looks different but better
/node/add/article -> Date field display — Looks broken
/admin/structure/types/manage/article/fields/node.article.field_image — Looks different but better
Comment #17
LewisNymanI'm hoping that we can fix the regressions here by modifying the form--inline styling to work in more situations, rather than add in exceptions for each situation.
Comment #18
kyuubi CreditAttribution: kyuubi commentedRerolling patch.
Comment #19
kyuubi CreditAttribution: kyuubi commentedMarking for review.
Comment #20
kyuubi CreditAttribution: kyuubi commentedOkay so it seems that the issue with the comments in:
/admin/content/comment — Incorrect spacing on desktop/mobile
Is due to the fact that it's not using the actions wrapper which according to form API:
"A wrapper element to group one or more buttons in a form. Use of the 'actions' element as an array key helps to ensure proper styling in themes and to enable other modules to properly alter a form's actions"
I am attaching the revised patch adding the wrapper in the CommentAdminOverview class
Comment #23
kyuubi CreditAttribution: kyuubi commentedHey,
The issue in the article is because the form--inline elements need to be cleared since we are now using floats.
I don't know what is your preferred method, overflow or pseudo element in the wrapper so I opted for the latter as it does not have the inconveniences of setting the overflow (hiding content if setting or scrollbar if setting auto).
Let me know what are your thoughts.
Comment #24
LewisNymanI've attached the original backstopJS report. I've also gone through each fail with comments:
So only a three errors we have to fix :)
Comment #25
LewisNymanOk sorry, that wasn't the full report because some pages were returning access denied. It's a little bit fiddly to configure the Drupal install as the BackstopJS user is anonymous.
Here are a few more regressions we need to look at. There is probably quite a bit of overlap between regressions.
Comment #26
Manjit.Singhrerolling a #23 patch
Comment #27
Manjit.SinghComment #28
Manjit.SinghComment #29
LewisNymanSetting back to needs work as per #24and #25
Comment #30
kyuubi CreditAttribution: kyuubi commentedAttaching rerolled patch.
Will look into fixing the above issues later tonight.
Comment #31
kyuubi CreditAttribution: kyuubi as a volunteer commentedHey guys,
Here goes the updated patch to address the issues raised in #24 and #25
I tried to make the changes as minimal as possible but it is possible there are side effects for the rule added in form.theme.css
Interdiff attached.
Comment #32
LewisNyman@kyuubi Thanks, I tested the UI translation page. It seems to of fixed the problem on desktop, but it has introduced a problem on mobile. There is no spacing now.
If we change this, isn't it going to affect all form-actions, even if they aren't part of form--inline? It looks like it.
Also, it looks like we need to add clearfix styling to the .form--inline class to stop it collapsing?
Comment #33
kyuubi CreditAttribution: kyuubi as a volunteer commentedHey,
First of all my bad on the
form .field-add-more-submit
, I thought I read it as inline (that's what you get for patching late night).I have reverted the changes there and added the clearfix.
As for the margin-top I applied it in a specific rule
.form--inline.form-actions
and mobile seems to be working fine (see attached screen).However, the fact is that this probably shouldn't be marked up like this.
If you look at other form actions (e.g content or comments) we have a form--inline wrapper and the form-items inside.
In this case though we have the form--inline in the form-actions element itself.
What you you propose we do here?
Attaching patch and interdiff from 31.
Comment #34
kyuubi CreditAttribution: kyuubi as a volunteer commentedChanging to needs review.
Comment #35
LewisNyman@kyuubi Great work! I think this is looking really good. The override fix for form-actions might have to be the minor imperfection we let go for now. I've attached the backstop JS report.
There's only one problem left to fix, which is the search form in Bartik.
Comment #36
irina.rozite CreditAttribution: irina.rozite at Wunder commentedPatch #33 does not work. Probably due other issue and bug resolving some files were changed and removed.
Comment #37
LewisNymanComment #38
Manjit.Singhrerolled a patch.
Comment #39
LewisNymanWe still need to fix the search form.
Comment #40
irina.rozite CreditAttribution: irina.rozite at Wunder commentedRerolled last patch, because it doesn't applied. Added fix for search form.
Comment #41
irina.rozite CreditAttribution: irina.rozite at Wunder commentedFixed tabspace errors in #40
Comment #42
Manjit.SinghProbably, This should be move to 8.x.2 branch.
Comment #45
Manjit.SinghComment #46
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commented#41 rerolled.
Comment #47
Sivaji_Ganesh_Jojodae CreditAttribution: Sivaji_Ganesh_Jojodae commentedComment #49
Manjit.Singhhere is the re-rolled patch.
Comment #50
gnugetI cannot reproduce the problem mentioned at #35.
I need to do something in specific in order to reproduce it?
Comment #51
Manjit.Singh@gnuget Issue that lewis has mentioned in #35 is reproducible below 1037px.
Comment #52
gnugetI tried to work on this using the patch #49 but it looked weird on my side, after of debugging I found out to some lines were missing from #33 so I made another re-roll from the original patch.
I attach the re-rolled patch and the interdiff between this one and 49.
I will continue working on this.
Comment #53
gnugetI just re-added the changes introduced by #40 for fixing the issue related to the search box.
And there was a similar problem in the search page, I fixed that one in this patch.
This is ready to be reviewed again.
Comment #54
gnugetComment #68
quietone CreditAttribution: quietone at PreviousNext commentedThis is blocking #2160621: Button spacing CSS is too fragile
Comment #70
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.