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

CommentFileSizeAuthor
#70 2417111-nr-bot.txt140 bytesneeds-review-queue-bot
#53 replace-2417111-53.patch17.99 KBgnuget
#53 2417111-interdiff-52-53.txt482 bytesgnuget
#52 replace-2417111-52.patch17.52 KBgnuget
#52 2417111-interdiff-49-52.txt1.46 KBgnuget
#49 replace-container-inline-2417111-49.patch17.79 KBManjit.Singh
#46 replace-container-inline-2417111-46.patch17.81 KBSivaji_Ganesh_Jojodae
#41 replace-container-inline-2417111-41.patch17.81 KBirina.rozite
#40 replace-container-inline-2417111-40.patch17.81 KBirina.rozite
#38 replace-container-inline-2417111-38.patch17.3 KBManjit.Singh
#35 Home___Site-Install.png10.46 KBLewisNyman
#35 BackstopJS-2417111-33.pdf5.34 MBLewisNyman
#33 interface_translation_mobile_screen.png78.61 KBkyuubi
#33 interdiff-31-33.txt1.03 KBkyuubi
#33 replace-container-inline-2417111-33.patch17.91 KBkyuubi
#32 Screenshot 2015-08-27 18.22.11.jpg32.93 KBLewisNyman
#32 Screenshot 2015-08-27 18.22.04.jpg36.95 KBLewisNyman
#32 Screenshot 2015-08-27 18.17.46.jpg225.36 KBLewisNyman
#31 replace-container-inline-2417111-31.patch18.05 KBkyuubi
#31 interdiff-30-31.txt893 byteskyuubi
#30 replace-container-inline-2417111-30.patch17.18 KBkyuubi
#26 replace-container-inline-2417111-26.patch17.56 KBManjit.Singh
#25 Pasted_Image_10_04_2015_11_44.png66.68 KBLewisNyman
#25 Pasted_Image_10_04_2015_11_42.png52.2 KBLewisNyman
#25 Pasted_Image_10_04_2015_11_39.png51.47 KBLewisNyman
#25 2417111-23-backstop-report.pdf5.68 MBLewisNyman
#24 Pasted_Image_10_04_2015_11_11.png156.28 KBLewisNyman
#24 Pasted_Image_10_04_2015_11_09.png55.93 KBLewisNyman
#24 Pasted_Image_10_04_2015_11_05.png34.86 KBLewisNyman
#24 2417111-23-backstop-report.pdf2.14 MBLewisNyman
#23 interdiff-19-23.txt514 byteskyuubi
#23 issue-2417111-23.patch17.56 KBkyuubi
#20 interdiff-18-19.txt702 byteskyuubi
#20 issue-2417111-19.patch17.06 KBkyuubi
#18 issue-2417111-18.patch16.64 KBkyuubi
#14 backstop.json_.txt1.82 KBLewisNyman
#14 2417111 - BackstopJS Report.pdf2.84 MBLewisNyman
#8 after_back_button.png467.05 KBkyuubi
#8 after_db_log_v2.png427.02 KBkyuubi
#8 after_locale_filter_v2.png420.65 KBkyuubi
#8 after_node_edit_author.png393.74 KBkyuubi
#8 after_node_edit_last_saved.png402.33 KBkyuubi
#8 after_path_filter.png421.9 KBkyuubi
#8 after_search_block_bartik.png461.89 KBkyuubi
#8 after_search_block_classy.png392.27 KBkyuubi
#8 after_search_form.png407.73 KBkyuubi
#8 after_search_pages.png438.94 KBkyuubi
#8 after_simpletest_results.png407.59 KBkyuubi
#8 after_views_fields_filter_options.png408.97 KBkyuubi
#8 after_views_multiple_field.png418.23 KBkyuubi
#8 after_views_override_nojs.png384.33 KBkyuubi
#8 after_views_rearrange_filters.png420.42 KBkyuubi
#8 after_views_wizard_block_display_settings.png385.37 KBkyuubi
#8 after_views_wizard_page_display_settings.png382.47 KBkyuubi
#8 after_views_wizards_views_settings.png379.67 KBkyuubi
#8 before_node_edit_author.png413.81 KBkyuubi
#8 before_node_edit_last_saved.png395.38 KBkyuubi
#8 before_pathfilter.png426.66 KBkyuubi
#8 before_preview_back_button.png474.54 KBkyuubi
#8 before_search_block_bartik.png462.54 KBkyuubi
#8 before_search_block_classy.png408.54 KBkyuubi
#8 before_search_form.png418.74 KBkyuubi
#8 before_search_pages.png431.74 KBkyuubi
#8 before_simpletest_results.png417.37 KBkyuubi
#8 before_views_fields_filter_options.png417.84 KBkyuubi
#8 before_views_multiple_field.png424.63 KBkyuubi
#8 before_views_override_nojs.png368.39 KBkyuubi
#8 before_views_rearrange_filters.png428.19 KBkyuubi
#8 before_views_wizard_block_display_settings.png385.61 KBkyuubi
#8 before_views_wizard_page_display_settings.png390.36 KBkyuubi
#8 before_views_wizards_views_settings.png382.68 KBkyuubi
#8 interdiff-5-8.txt10.96 KBkyuubi
#8 issue-issue-2417111-8.patch18.42 KBkyuubi
#6 Screen Shot 2015-03-17 at 13.29.45.jpg869.28 KBLewisNyman
#6 Screen Shot 2015-03-17 at 13.14.03.jpg999.1 KBLewisNyman
#5 after_date_widget.png420.38 KBkyuubi
#5 before_date_widget.png418.73 KBkyuubi
#5 after_db_log.png412.71 KBkyuubi
#5 before_dblog.png428.06 KBkyuubi
#5 after_editor_align.png414.22 KBkyuubi
#5 before_editor_align.png410.37 KBkyuubi
#5 after_editor_dialog.png430.2 KBkyuubi
#5 before_editor_dialog.png428.38 KBkyuubi
#5 after_image_editor.png429.47 KBkyuubi
#5 before_image_editor.png427.96 KBkyuubi
#5 after_locale_filter.png421.15 KBkyuubi
#5 before_locale_filter.png418.65 KBkyuubi
#5 after_maximage_settings.png443.27 KBkyuubi
#5 before_maximage_settings.png446.32 KBkyuubi
#5 after_minimage_settings.png448 KBkyuubi
#5 before_minimage_settings.png449.78 KBkyuubi
#5 after_comments_action.png417.3 KBkyuubi
#5 before_comments_action.png410.78 KBkyuubi
#5 after_action_advanced_form.png417.14 KBkyuubi
#5 before_action_advanced_form.png414.69 KBkyuubi
#5 issue-2417111-5.patch9.12 KBkyuubi
#2 Screen Shot 2015-03-15 at 1.53.59 pm.png323.04 KBkyuubi

Issue fork drupal-2417111

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

kyuubi’s picture

Assigned: Unassigned » kyuubi

Happy to start working on this.

kyuubi’s picture

Hi 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,

LewisNyman’s picture

If not do we prefer to use container-inline for these situations or replace everything with form--inline?

There 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

kyuubi’s picture

Sure 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.

kyuubi’s picture

Hi 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,

LewisNyman’s picture

Nice! As you said, a big part of the regression here are to do with container-inline using display: inline; which unset all the margins on those elements. See: #2226317: Divs in the container-inline wrapper should be inline-block instead of inline

I'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 need

LewisNyman’s picture

Status: Needs review » Needs work
kyuubi’s picture

Ufff...

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?

kyuubi’s picture

Status: Needs work » Needs review
LewisNyman’s picture

Issue summary: View changes

I've added some of the test urls so we can run a visual regression test.

kyuubi’s picture

Hey,

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?

LewisNyman’s picture

Assigned: kyuubi » Unassigned
Issue summary: View changes

THanks, I'm going to give this a run through with Backstop.js

LewisNyman’s picture

FileSize
18.43 KB

Rerolled patch

LewisNyman’s picture

Status: Needs review » Needs work
FileSize
2.84 MB
1.82 KB

I'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 :)

kyuubi’s picture

Hi LewisNyman,

Cool stuff :)

Where do you propose we go from here?

LewisNyman’s picture

Hey, 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

LewisNyman’s picture

I'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.

kyuubi’s picture

FileSize
16.64 KB

Rerolling patch.

kyuubi’s picture

Status: Needs work » Needs review

Marking for review.

kyuubi’s picture

FileSize
17.06 KB
702 bytes

Okay 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

Status: Needs review » Needs work

The last submitted patch, 20: issue-2417111-19.patch, failed testing.

kyuubi queued 20: issue-2417111-19.patch for re-testing.

kyuubi’s picture

Status: Needs work » Needs review
FileSize
17.56 KB
514 bytes

Hey,

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.

LewisNyman’s picture

Issue summary: View changes
Status: Needs review » Needs work
FileSize
2.14 MB
34.86 KB
55.93 KB
156.28 KB

I've attached the original backstopJS report. I've also gone through each fail with comments:



So only a three errors we have to fix :)

LewisNyman’s picture

Ok 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.



Manjit.Singh’s picture

rerolling a #23 patch

Manjit.Singh’s picture

Issue tags: -Needs reroll
Manjit.Singh’s picture

Status: Needs work » Needs review
LewisNyman’s picture

Status: Needs review » Needs work

Setting back to needs work as per #24and #25

kyuubi’s picture

Attaching rerolled patch.

Will look into fixing the above issues later tonight.

kyuubi’s picture

Status: Needs work » Needs review
FileSize
893 bytes
18.05 KB

Hey 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.

LewisNyman’s picture

Issue summary: View changes
Status: Needs review » Needs work
FileSize
225.36 KB
36.95 KB
32.93 KB

@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.

+++ b/core/modules/system/css/components/form.theme.css
@@ -28,7 +28,6 @@ form .field-add-more-submit {
 .form-actions {
-  margin-top: 1em;
   margin-bottom: 1em;

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?

kyuubi’s picture

Hey,

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.

kyuubi’s picture

Status: Needs work » Needs review

Changing to needs review.

LewisNyman’s picture

Issue summary: View changes
Status: Needs review » Needs work
FileSize
5.34 MB
10.46 KB

@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.

irina.rozite’s picture

Patch #33 does not work. Probably due other issue and bug resolving some files were changed and removed.

error: patch failed: core/modules/editor/src/Form/EditorImageDialog.php:147
error: core/modules/editor/src/Form/EditorImageDialog.php: patch does not apply
error: core/modules/system/css/components/inline-form.theme.css: No such file or directory
LewisNyman’s picture

Issue tags: +Needs reroll
Manjit.Singh’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
17.3 KB

rerolled a patch.

LewisNyman’s picture

Status: Needs review » Needs work

We still need to fix the search form.

irina.rozite’s picture

Status: Needs work » Needs review
FileSize
17.81 KB

Rerolled last patch, because it doesn't applied. Added fix for search form.

irina.rozite’s picture

Manjit.Singh’s picture

Version: 8.0.x-dev » 8.2.x-dev

Probably, This should be move to 8.x.2 branch.

Status: Needs review » Needs work

The last submitted patch, 41: replace-container-inline-2417111-41.patch, failed testing.

The last submitted patch, 41: replace-container-inline-2417111-41.patch, failed testing.

Manjit.Singh’s picture

Issue tags: +Needs reroll
Sivaji_Ganesh_Jojodae’s picture

Sivaji_Ganesh_Jojodae’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 46: replace-container-inline-2417111-46.patch, failed testing.

Manjit.Singh’s picture

Status: Needs work » Needs review
FileSize
17.79 KB

here is the re-rolled patch.

gnuget’s picture

I cannot reproduce the problem mentioned at #35.

I need to do something in specific in order to reproduce it?

Manjit.Singh’s picture

Status: Needs review » Needs work

@gnuget Issue that lewis has mentioned in #35 is reproducible below 1037px.

gnuget’s picture

I 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.

gnuget’s picture

I 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.

gnuget’s picture

Issue summary: View changes

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

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

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

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

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.

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.

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

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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.

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.

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dseixas-Javali made their first commit to this issue’s fork.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
FileSize
140 bytes

The 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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.