Problem/Motivation

(Why the issue was filed, steps to reproduce the problem, etc.)

Steps to reproduce

(Detailed instructions on how to reproduce the issue, including exact versions used, specific paths to visit, what actions to take, etc.)

Proposed resolution

(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)

Remaining tasks

(reviews needed, tests to be written or run, documentation to be written, etc.)

User interface changes

(New or changed features/functionality in the user interface, modules added or removed, changes to URL paths, changes to user interface text.)

API changes

(API changes/additions that would affect module, install profile, and theme developers, including examples of before/after code if appropriate.)

Data model changes

(Database or configuration data changes that would make stored data on an existing site incompatible with the site's updated codebase, including changes to hook_schema(), configuration schema or keys, or the expected format of stored data, etc.)

Release notes snippet

(Major and critical issues should have a snippet that can be pulled into the release notes when a release is created that includes the fix)

Original report by @Manuel Garcia

(Text of the original report, for legacy issues whose initial post was not the issue summary. Use rarely.)

As part of the ongoing discussion on #1842040: [meta] Decide on where to use modal dialogs

It would make sense to keep the user on the same page, so he/she does not lose context. It's also slightly faster.

CommentFileSizeAuthor
#51 2880003-51.patch9.43 KBlauriii
#47 interdiff-2880003-40-47.txt1009 bytesBS Pavan
#47 2880003-47.patch9.83 KBBS Pavan
#45 After_patch_screenshot.png44.78 KBvikashsoni
#42 After patch rec.mp43.02 MBmanojithape
#42 Before patch rec.mp41.8 MBmanojithape
#40 interdiff_38-40.txt779 bytesvsujeetkumar
#40 2880003-40.patch9.79 KBvsujeetkumar
#38 interdiff_36-38.txt2.33 KBvsujeetkumar
#38 2880003-38.patch8.82 KBvsujeetkumar
#36 2880003-36.patch8.76 KBranjith_kumar_k_u
#27 2880003-27.patch8.92 KBManuel Garcia
#27 interdiff.txt870 bytesManuel Garcia
#26 2880003-26.patch8.92 KBManuel Garcia
#25 2880003-25.patch125.12 KBManuel Garcia
#25 interdiff.txt4.06 KBManuel Garcia
#24 interdiff.txt2.44 KBtacituseu
#24 2880003-24.patch5.72 KBtacituseu
#21 2880003-21.patch5.16 KBManuel Garcia
#21 interdiff.txt3.07 KBManuel Garcia
#18 2880003-18.patch4.99 KBManuel Garcia
#18 interdiff.txt1.16 KBManuel Garcia
#16 2880003-15.patch4.84 KBManuel Garcia
#12 2880003-12.patch4.98 KBManuel Garcia
#12 interdiff.txt2.65 KBManuel Garcia
#9 2880003-9.patch5.51 KBManuel Garcia
#9 interdiff.txt2.56 KBManuel Garcia
#2 2880003-2.patch2.95 KBManuel Garcia
Peek 2017-05-20 09-25.gif4.09 MBManuel Garcia

Issue fork drupal-2880003

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

Manuel Garcia created an issue. See original summary.

Manuel Garcia’s picture

Assigned: Manuel Garcia » Unassigned
Status: Active » Needs review
FileSize
2.95 KB

Here's a starting point.

bojanz’s picture

Feels a bit odd to special case this UI.
Why don't we open an issue to modalize all delete forms? They all pretty much look the same, so they share the same benefit of being in a modal.

vijaycs85’s picture

Great start @manuel-garcia

Probably we can have a no-patch/policy issue to discuss and fix common problems and approach and can have child issues to group by functionality (i.e.. all delete form) or component (all forms in field UI) based depending on size.

Some of the common problems:

  1. +++ b/core/modules/field_ui/src/FieldConfigListBuilder.php
    @@ -132,7 +133,16 @@ public function buildRow(EntityInterface $field_config) {
    +                'title' => $this->t('Edit field settings.'),
    +                'class' => ['use-ajax'],
    +                'data-dialog-type' => 'modal',
    +                'data-dialog-options' => Json::encode([
    +                  'width' => 700,
    

    This is repeating for every item. probably we can have a common place and elements can have one element attribute to use these values as it is and allow to override, if necessary.

  2. Accessibility review
Manuel Garcia’s picture

Issue summary: View changes

Re #3 I agree, this should not get in just on itself, updating the description.
Re #4 Yes.

Please see the parent issue #1842040: [meta] Decide on where to use modal dialogs

Manuel Garcia’s picture

vijaycs85’s picture

Issue tags: +Needs tests

Thanks for finding related issues @Manuel Garcia. Few things from related issues:

  1. Width: Seems we can leave the width to 'auto' instead of fixed 700
  2. Adding tests like we have in #2253257-49: Use a modal for entity delete operation links
Manuel Garcia’s picture

Status: Needs review » Needs work

Thanks @vijaycs85 for the review!

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
2.56 KB
5.51 KB

Here's a start on the tests, currently only checking the delete button, but its failing on my local environment as if the modal doesn't pop up..., let's see if its just me but I could probably use a hand figuring out what I'm missing... once we get this working I'll add coverage for the other modal links.

tacituseu’s picture

Dialogs are tricky, at the very least you need to use there:
$assert_session->waitForElementVisible('named_exact', ...), but that likely won't be 100%, see #2856047: Avoid random failures in JavascriptTestBase when testing functionality in a dialog for more.

Status: Needs review » Needs work

The last submitted patch, 9: 2880003-9.patch, failed testing.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
2.65 KB
4.98 KB

Cleaning up unnecessary field creation, since entity_test already provides you with one.

Thanks for the heads up @tacituseu , I have done what you suggested, which is a good idea - though I'm afraid it looks like the failure might not be related to this.

It looks like either the modal doesn't show up, or the comparing of the route to make sure we are still at the same page is wrong:

Current page is "/entity_test/structure/entity_test/fields/entity_test.entity_test.field_test_text/delete", but "/entity_test/structure/entity_test/fields" expected.

Status: Needs review » Needs work

The last submitted patch, 12: 2880003-12.patch, failed testing.

Manuel Garcia’s picture

Re #7.1 - On admin/structure/block we use width 700 to place blocks, which works perfectly, and the modal is still responsive friendly. I think we should stick to using the same width as there.

Manuel Garcia’s picture

Status: Needs work » Needs review
Manuel Garcia’s picture

Status: Needs review » Needs work

The last submitted patch, 16: 2880003-15.patch, failed testing.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
1.16 KB
4.99 KB

Oops, clearly I was going too fast last night.

Status: Needs review » Needs work

The last submitted patch, 18: 2880003-18.patch, failed testing.

tacituseu’s picture

You can use Drupal\Tests\views_ui\FunctionalJavascript\FilterCriteriaTest as a template, it should have all you need as it also is testing dropbutton with dialog, and works most of the time.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
3.07 KB
5.16 KB

Thanks @tacituseu, i had a look, and tried to mimic that test, but no luck.

In this patch:

  • Removed the use of entity_test and just created a test node type with the standard body field which is enough.
  • Test for the #drupal-modal element instead of checking the path we're on which still fails.

So I am blocked on this essentially. Giving up (at least for now) since I see no reason why this fails. I've checked using stark as the admin theme, and it works fine...

Status: Needs review » Needs work

The last submitted patch, 21: 2880003-21.patch, failed testing.

tacituseu’s picture

@Manuel Garcia: it fails at $modal = $page->findById('drupal-modal'); I'll investigate why in test issue.

tacituseu’s picture

Status: Needs work » Needs review
FileSize
5.72 KB
2.44 KB

It was mostly because of missing:
$build['#attached']['library'][] = 'core/drupal.dialog.ajax';.

You can see the screenshots, the bad height is due to debounce on the dialog (here's the patch to create them).

Manuel Garcia’s picture

Issue tags: -Needs tests
FileSize
4.06 KB
125.12 KB

HAH! so the failures were actually finding a bug in the previous code... I can be so hard headed sometimes lol

Thank you SO much @tacituseu for that!

Attached the coverage for the other 3 links that we're modifying to show up in a modal.

Manuel Garcia’s picture

Appologies, ignore the patch on #25, I forgot to rebase my branch before generating the patch. The interdiff on #25 is correct.

Manuel Garcia’s picture

Fixing the coding standards violation found by the bot.

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.

ranjith_kumar_k_u’s picture

Re-rolled the last patch for 9.3

Status: Needs review » Needs work

The last submitted patch, 36: 2880003-36.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
8.82 KB
2.33 KB

Fixed some fail tests, Updated functional javascript tests according to drupal 9.3.x standard.

Status: Needs review » Needs work

The last submitted patch, 38: 2880003-38.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
FileSize
9.79 KB
779 bytes

Fixed Tests, Please have a look.

manojithape’s picture

Assigned: Unassigned » manojithape
manojithape’s picture

Assigned: manojithape » Unassigned
Status: Needs review » Reviewed & tested by the community
FileSize
1.8 MB
3.02 MB

Verified and tested patch#40 on the drupal 9.3.x-dev version. Patch applied successfully and looks good to me.

Testing Steps:

  1. Install drupal 9.3.x-dev version.
  2. Go to /admin/structure/types/manage/article/fields
  3. Click on Edit or Storage Setting or Delete option and observe the modal not displayed to manage the field setting.
  4. Now apply the patch and again verify by clicking on the Edit or Storage Setting or Delete option modal open to manage the field setting.

Expected Result:

  1. By clicking on the Edit or Storage Setting or Delete option modal should open to manage the field setting.
  2. Modal should display properly and work expected.

Actual Result:

  1. By clicking on the Edit or Storage Setting or Delete option modal opens to manage the field setting.
  2. Also, that modal displayed properly on the Mobile and desktop.

For reference, please refer to the attached screen recording video.

Move this ticket to RTBC.

Kartagis’s picture

Issue summary: View changes
Mile23’s picture

vikashsoni’s picture

FileSize
44.78 KB

Applied patch #40 working fine now i am able to use modals in manage fields for reference sharing screenshot

quietone’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

The gif in the IS is from 2009! The Issue Summary definitely needs to be updated. This makes it easier for any reviewer and committer to do their work. I suggest adding the standard template and completing all the sections. See Write an issue summary for an existing issue for guidance on doing that.

This is also a fairly big change and I wonder what approval it may need (still learning that). And it would be helpful to know if there is any criteria or goals in the Meta that are to be included in the patch.

@manojithape, thanks for the detailed testing steps and screenshots. They should go in the Issue Summary. Also, a working patch is not sufficient to mark an issue RTBC. There are several steps, or core gates that an issue must pass first.

@vikashsoni, there is already a video of the patch being used, there is no need for more. Therefore removing credit per How is credit granted for Drupal core issues.

I skimmed the patch and found this small change.

  1. +++ b/core/modules/field_ui/tests/src/FunctionalJavascript/FieldConfigListBuilderTest.php
    @@ -0,0 +1,137 @@
    +    $this->adminUser = $this->drupalCreateUser(['administer content types', 'administer node fields']);
    

    This would be easier to read if on multiple lines.

  2. +++ b/core/modules/field_ui/tests/src/FunctionalJavascript/FieldConfigListBuilderTest.php
    @@ -0,0 +1,137 @@
    +   * Test that field type column storage forms use a modal dialog.
    

    s/Test/Tests/

BS Pavan’s picture

Status: Needs work » Needs review
FileSize
9.83 KB
1009 bytes

Making the changes as suggested in #46, please check.

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.

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.

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.

lauriii’s picture

Rerolled #47 to 10.1.x.

Status: Needs review » Needs work

The last submitted patch, 51: 2880003-51.patch, failed testing. View results

lauriii’s picture

Issue tags: +Usability, +Field UX

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

bnjmnm’s picture

Added an MR with all tests passing. Left a few things that need addressing in the MR.

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

hooroomoo’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs accessibility review, +Needs usability review

MR appears to have issues.

Could there be a way for a site to opt out of this? Modals are neat but for a number of our sites I don't imagine we would want this.
Tagging for usability and accessibility review.

Was previously tagged for issue summary which still appears to need and happen.

lauriii’s picture

Thank you for your feedback @smustgrave! At the moment there isn't a way to opt out of this. I'm curious to know why you believe using modals would be a regression for your sites. 😊 Is there something that we should change about the implementation that would make the user experience more seamless?

smustgrave’s picture

Let me ask, could there be a scenario where a custom module with a custom field could break with this change? And there be no way to edit your field.

Other concern is accessibility. Know Drupal backend is not the best with that but adding to it would seem bad to me.

smustgrave’s picture

This almost reminds of the overlay module of Drupal 7. Think I got that right.

lauriii’s picture

Let me ask, could there be a scenario where a custom module with a custom field could break with this change? And there be no way to edit your field.

You're right that this could be disruptive to a custom field type which configuration form relies on JavaScript (and the JavaScript hasn't been written according to Drupals best practices). Do we have any examples of field types that would ship JavaScript for their admin form?

There certainly would be workarounds (i.e. open the link in a new tab) to this but it wouldn't be ideal to have users rely on that. We would also do something like this only in a future minor giving people time to test and fix their custom code.

Other concern is accessibility. Know Drupal backend is not the best with that but adding to it would seem bad to me.

Do you have specific accessibility concerns in mind? I would love to make sure that we are taking those into account 😊

We certainly want to make sure that the solution is accessible and easy to use for all users. This has already received some feedback regarding accessibility from @bnjmnm who is a provisional accessibility topic maintainer, and I know that he's keeping a close eye on this. We are also using dialogs in some pre-existing UIs such as Layout Builder, meaning that it is a pre-existing pattern which has received review in the past.

lauriii’s picture

This almost reminds of the overlay module of Drupal 7. Think I got that right.

Overlay opened all of the admin pages in a dialog. While this is also utilizing dialogs, it is not exactly the same since we are only using it for specific actions. This is similar to the block UI where a block can be added through a dialog, without having to navigate to a separate page. What is interesting about the block UI is that it is not using dialogs for editing blocks 🤔

smustgrave’s picture

Don't quote me but my only knowledge of modals is that focus must remain inside the modal while it's open for tabbed users. Must be able to be closed via tab. Not sure what/if any aria attributes it may need.

lauriii’s picture

We are utilizing the built-in Drupal Dialog (which is using jQuery UI Dialog) which should have all of the necessary accessibility considerations implemented. AFAIK it cannot be closed with a tab and I've personally not heard of that before. If that's a requirement for modal dialogs to be accessible, we should probably open a new issue to investigate that in relation to all of our dialogs.

One issue we are aware of specifically in relation to this issue is that when a dialog is opened using a link that is inside dropbutton, focus is not returned to the triggering element because it is no longer focusable. This is something that will need to be addressed as part of this issue.

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

tim.plunkett made their first commit to this issue’s fork.

tim.plunkett’s picture

I removed a lot of unrelated code that was from prototyping other Field UI changes.

I also fixed the next few failing steps in EntityReferenceAdminTest.

However, I highlighted (see the newly add @todo's) the problem we're still facing.
FormBuilder has this code:

    // If this form is an AJAX request, disable all form redirects.
    if ($ajax_form_request = $request->query->has(static::AJAX_FORM_REQUEST)) {
      $form_state->disableRedirect();
    }

which is good, because we don't want it to redirect, but bad, because we have to figure out how to share the destination logic between the submit and the ajaxSubmit.

Meaning, if JS is disabled, things work as expected, but with it on, the AJAX code doesn't know where to take you next. And each form in the chain needs to be fixed.

tim.plunkett’s picture

Status: Needs work » Postponed

All of those concerns are for the Add Field flow, which is extremely complicated right now. That portion could be handled in a follow-up, while this can make the links in the dropbutton use a modal.
But until we decide to do that, postponing this on #3347291: Combine field storage and field instance forms

lauriii’s picture

Title: Use modals on the Manage Fields page » [PP-1] Use modals on the Manage Fields page

Converting the field creation flow to use modal is blocked by #3358049: Save FieldStorageConfig at the same time as FieldConfig. This would be also simplified by #3347291: Combine field storage and field instance forms, but this isn't a hard requirement for working on this issue.

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.

benjifisher’s picture

Title: [PP-1] Use modals on the Manage Fields page » Use modals on the Manage Fields page
Issue summary: View changes
Status: Postponed » Needs work

In Comment #46, @quietone asked for an issue summary update. I am not familiar enough with the current work to update the description myself, but as a first step I have added the standard template. I am keeping the "Needs issue summary update" issue tag.

In Comment #70, this issue was postponed on #3347291: Combine field storage and field instance forms. Comment #72 also mentions #3358049: Save FieldStorageConfig at the same time as FieldConfig. Both of those issues have landed, so I am un-postponing this issue. If it should still be postponed, then please mention the blocking issue in the "Remaining tasks" section of the issue summary. (See the link in Comment #46.)