Problem/Motivation

Update entity delete and field delete operation links to use a modal by default, as delete forms are simple confirm forms in 99.99% of all cases (that 0.01% is just so nobody can tell me I forgot anyone :-P). No reason to make the user go to a different page for this.

Proposed resolution

Update all links to the entity delete and field delete confirmation form to use a modal by default.

Remaining tasks

Update delete link on entity edit form.
Update entity operations delete link
Accessiblity review
Review the patch

User interface changes

Clicking on entity delete links on the edit form or delete tab should bring up the confirmation form in a modal.

The scope extended to include field deletion in a modal in comment #133

API changes

None

Data model changes

None

CommentFileSizeAuthor
#168 2253257-168-manual-test.diff612 byteslauriii
#166 2253257-166-manual-test.diff973 byteslauriii
#165 Screenshot 2023-05-31 at 10.23.30.png165.28 KBlauriii
#164 delete-modal-ajax-view.png129.76 KBmstrelan
#157 2253257-11X.patch14.45 KBbnjmnm
#126 safari-16.3.png612.77 KBnarendrar
#126 firefox-112.0.png792.54 KBnarendrar
#126 chrome-112.0.5615.121.png541.35 KBnarendrar
#124 delete-translations.png107.83 KBbnjmnm
#112 2253257-nr-bot.txt86 bytesneeds-review-queue-bot
#111 aftr_108_menulink.png490.67 KBsonam.chaturvedi
#110 2253257-after-patch.png343.5 KBnayana_mvr
#110 2253257-before-patch.png254.26 KBnayana_mvr
#108 2253257-108.patch7.25 KBhooroomoo
#107 2253257-102.patch7.3 KBhooroomoo
#101 interdiff_99-101.txt783 bytesvsujeetkumar
#101 2253257-101.patch7.31 KBvsujeetkumar
#99 2253257-99.patch7.22 KBvsujeetkumar
#99 2253257-99.patch7.22 KBvsujeetkumar
#89 interdiff-2253257-87-89.txt814 byteschr.fritsch
#89 2253257-89.patch7.22 KBchr.fritsch
#87 2253257-87.patch7.22 KBandrewmacpherson
#70 2253257-70.patch7.18 KBborisson_
#70 interdiff-2253257-65-70.txt1.3 KBborisson_
#65 interdiff-2253257-62-65.txt1.12 KBchr.fritsch
#65 2253257-65.patch7.17 KBchr.fritsch
#62 interdiff-2253257-57-62.txt1.69 KBchr.fritsch
#62 2253257-62.patch7.17 KBchr.fritsch
#57 2253257-57.patch7.18 KBchr.fritsch
#50 2253257-loading-icon.png88.98 KBvijaycs85
#49 2253257-49.patch6.9 KBmanuel garcia
#49 interdiff.txt567 bytesmanuel garcia
#47 2253257-47.patch6.92 KBMunavijayalakshmi
#45 2253257-45.patch6.93 KBjhedstrom
#45 interdiff.txt877 bytesjhedstrom
#43 2253257-43.patch6.98 KBjhedstrom
#43 interdiff.txt1.24 KBjhedstrom
#39 2253257-39.patch6.95 KBjhedstrom
#39 interdiff.txt2.43 KBjhedstrom
#38 2253257-38.patch4.51 KBjhedstrom
#38 interdiff.txt2.41 KBjhedstrom
#35 2253257-35.patch3.18 KBjhedstrom
#35 interdiff.txt649 bytesjhedstrom
#33 2253257-33.patch3.2 KBjhedstrom
#24 drupal_2253257_24.patch3.21 KBswentel
#22 delete2.png49.76 KBwiifm
#22 delete1.png33.16 KBwiifm
#21 drupal_2253257_21.patch3.19 KBxano
#14 drupal_2253257_14.patch3.25 KBxano
#14 interdiff.txt1.16 KBxano
#12 drupal_2253257_12.patch2.83 KBxano
#8 drupal_2253257_8.patch2.85 KBxano
#8 interdiff.txt819 bytesxano
#3 drupal_2253257_2.patch2.49 KBxano
#1 drupal_2253257_1.patch1.64 KBxano

Issue fork drupal-2253257

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:

Comments

xano’s picture

Status: Active » Needs review
StatusFileSize
new1.64 KB

Status: Needs review » Needs work

The last submitted patch, 1: drupal_2253257_1.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new2.49 KB
xano’s picture

larowlan’s picture

Looks like the modal title isn't coming through correctly.
I would expect to see the question 'Are you sure you want to delete' etc.
screenshot

xano’s picture

That is because of #2255369: DialogController does not respect $content['#title'] for the page title. The question doesn't fit the space the modal reserves for the title, though.

tim.plunkett’s picture

+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php
@@ -123,6 +123,10 @@ protected function getDefaultOperations(EntityInterface $entity) {
+          'class' => array('use-ajax'),
+          'data-accepts' => 'application/vnd.drupal-modal',

If you add

      'data-dialog-options' => Json::encode(array(
        'width' => 'auto',
      )),

Then it will fit just fine.

xano’s picture

Issue summary: View changes
StatusFileSize
new819 bytes
new2.85 KB

Many entity delete pages have <em> in their titles, which isn't properly displayed by the modal, but that's for another issue as well.

Status: Needs review » Needs work

The last submitted patch, 8: drupal_2253257_8.patch, failed testing.

xano’s picture

Status: Needs work » Needs review

8: drupal_2253257_8.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 8: drupal_2253257_8.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new2.83 KB

Re-roll.

Status: Needs review » Needs work

The last submitted patch, 12: drupal_2253257_12.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new1.16 KB
new3.25 KB
tim.plunkett’s picture

+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php
@@ -122,6 +122,13 @@ protected function getDefaultOperations(EntityInterface $entity) {
+          'class' => array('use-ajax'),
+          'data-accepts' => 'application/vnd.drupal-modal',
+          'data-dialog-options' => Json::encode(array(
+            'width' => 'auto',
+          )),

Out of scope for this issue, but it'd be realllly nice if we had a way to just have 'class' => array('use-modal'), and it would expand to all of this.

larowlan’s picture

xano’s picture

14: drupal_2253257_14.patch queued for re-testing.

xano’s picture

Since we have to use somewhat more verbose code until that other issue is fixed, do we want to postpone this one, or just get it in?

14: drupal_2253257_14.patch queued for re-testing.

xano’s picture

14: drupal_2253257_14.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 14: drupal_2253257_14.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new3.19 KB

Re-roll.

wiifm’s picture

Status: Needs review » Needs work
Issue tags: +Drupal8NZ
StatusFileSize
new33.16 KB
new49.76 KB

Steps to test:

Visit /admin/structure/types, click delete on the content types

Content type with content:

Issues:

  • Needs an action button to dismiss the dialog (not just a close cross in the corner)
  • Double escaped HTML in the dialog header

Content type with no content:

Issues:

  • Cancel link should be next to the delete link - seems weird in the modal body
  • Double escaped HTML in the dialog header
larowlan’s picture

Issue tags: +Needs reroll
swentel’s picture

Issue tags: -Needs reroll
StatusFileSize
new3.21 KB

rerolled - not sure what the best strategy is for the escaped titles.

dawehner’s picture

Isn't that the same kind of problem as what got tackled on #2207247: Dialog titles double escaped for views handlers and delete forms ?

swentel’s picture

@dawehner indeed

adci_contributor’s picture

Status: Needs work » Needs review

rerolled

Guess we should sending it to testbot.

dawehner’s picture

Status: Needs review » Postponed

The other one seems to have an okay from nod_, so let's postpone this issue on top of the other one?

mgifford’s picture

berdir’s picture

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

And.. its one year later ;)

I've just RTBC'd #2207247: Dialog titles double escaped for views handlers and delete forms as nobody else wanted to do it. Maybe we can try this again for 8.x-1.x. Note that many config delete forms got quite a bit bigger due to config dependency information but I guess this still makes sense.

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

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.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.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.

jhedstrom’s picture

Status: Postponed » Needs review
Issue tags: +Needs tests
StatusFileSize
new3.2 KB

This is just a re-roll of #24--it doesn't appear to be working though as something must have changed in the past few years. We can also now add javascript tests for this. I came across this issue while working on #2828201: Add a modal form option to the confirm and field entry form action link types.

berdir’s picture

See #2488192: Modal/dialog/ajax is using query parameters instead of accept headers, you want data-dialog-type now, no longer the arcane accepts header.

jhedstrom’s picture

StatusFileSize
new649 bytes
new3.18 KB

Thanks @berdir!

This is now working--still probably needs a js test though.

The last submitted patch, 33: 2253257-33.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 35: 2253257-35.patch, failed testing.

jhedstrom’s picture

Status: Needs work » Needs review
StatusFileSize
new2.41 KB
new4.51 KB

Fixes the failing tests.

jhedstrom’s picture

StatusFileSize
new2.43 KB
new6.95 KB

This has the start of a test. See the @todo for some odd behavior. I'd expect a new page load with a confirmation message on submit. However, the entity does appear to be deleted...

Status: Needs review » Needs work

The last submitted patch, 39: 2253257-39.patch, failed testing.

jhedstrom’s picture

That's a failure I haven't come across before:

Current page is "/entity_test/list", but "/checkout/entity_test/list" expected.

I would have thought that $this->assertSession()->addressEquals(Url::fromRoute('entity.entity_test.collection')->toString()); would take a subdirectory into account...

berdir’s picture

@jhedstrom: Looks to me like it fails *because* it takes that into account: We actually are on /checkout/entity_test/list and it sees just /entity_test/list but toString() includes the directory. Try '/' . getInternalPath(), or just hardcode it..

jhedstrom’s picture

Status: Needs work » Needs review
StatusFileSize
new1.24 KB
new6.98 KB

Ah, I was reading that backwards. I made the change suggested in #42, and have also changed to not use the loadUnchanged(), and instead just manually cleared the cache (there is an @todo on the method that suggests its behavior will change in the future).

I am still not sure why the page isn't reloading after clicking on the delete button.

jhedstrom’s picture

Issue tags: -Needs tests

I am still not sure why the page isn't reloading after clicking on the delete button.

I figured out why this appears to be the case. Apparently when using clickLink, the verbose page visit logging does not take place, so it only appeared there was no page reload when I was looking at the pages generated by the html output printer.

jhedstrom’s picture

StatusFileSize
new877 bytes
new6.93 KB

Given #44, this removes the @todo and just checks for the delete message to be present on the page.

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.

Munavijayalakshmi’s picture

StatusFileSize
new6.92 KB

Rerolled the patch #45.

droplet’s picture

Love it.

there's a little problem which is similar to this: #2741877: Nested modals don't work: opening a modal from a modal closes the original

We can assign a new selector to avoid this problem. @see #2741877 Comment 3. (also @see #2741877 Comment 12 for my points)

Thanks.

manuel garcia’s picture

StatusFileSize
new567 bytes
new6.9 KB

Patch stil applies cleanly, looks great, and it seems to work as advertised (tested it a bit manually).

One small nitpick:

+++ b/core/tests/Drupal/FunctionalJavascriptTests/Core/Entity/EntityListBuilderTest.php
@@ -0,0 +1,72 @@
\ No newline at end of file

Fixing that on the go with this patch (please don't credit me for this!).

Anything else we need to be doing here?

vijaycs85’s picture

StatusFileSize
new88.98 KB

Loading icon is coming on next line(ref: screenshot). I guess @Manuel Garcia has fixed it in #2830584: Use modals for creating, updating, and deleting workflows, with a new DialogFormTrait

manuel garcia’s picture

manuel garcia’s picture

+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php
@@ -150,6 +151,13 @@ protected function getDefaultOperations(EntityInterface $entity) {
+            'width' => 'auto',

+++ b/core/modules/config/src/Tests/ConfigEntityListTest.php
@@ -64,6 +65,13 @@ public function testList() {
+            'width' => 'auto',

@@ -134,6 +142,13 @@ public function testList() {
+            'width' => 'auto',

On admin/structure/block, we use width 700, which works great, and is still responsive friendly.

Can we use the same width here?

yoroy’s picture

I tried twice on simplytest with the latest patch but did not get a modal when deleting an article. Am I missing something?

vijaycs85’s picture

Title: Use a modal for entity delete operation links » Use a modal for config entity delete operation links

yeah, this issue is for config entities. Content entities are in #2254935: Use a modal for content entity form delete links confirmation forms. Updated titles on both issues :)

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.

chr.fritsch’s picture

StatusFileSize
new7.18 KB

Just a re-roll

manuel garcia’s picture

Thanks for the rerroll @chr.fritsch

About the issue mentioned around the loading icon on #50 - The fix that was originally part of #2830584: Use modals for creating, updating, and deleting workflows, with a new DialogFormTrait was split off into its own issue, and was already fixed: #2909882: Throbbers showing within dropbuttons jump to next line - We should probably verify it is now working in this situation just in case.

chr.fritsch’s picture

I checked the use-case from @vijaycs85 in #50 and can verify that this issue is already fixed

manuel garcia’s picture

Re #52:

+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php
@@ -154,6 +155,13 @@ protected function getDefaultOperations(EntityInterface $entity) {
+          'data-dialog-options' => Json::encode([
+            'width' => 'auto',
+          ]),

+++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php
@@ -67,6 +68,13 @@ public function testList() {
+          'data-dialog-options' => Json::encode([
+            'width' => 'auto',
+          ]),

@@ -137,6 +145,13 @@ public function testList() {
+          'data-dialog-options' => Json::encode([
+            'width' => 'auto',
+          ]),

I have checked in core, and in all places we're using a width of 700:

  • BlockListBuilder
  • BlockLibraryController
  • PlaceBlockPageVariant
  • ContentModerationConfigureForm

Only on \Drupal\off_canvas_test\Controller\TestController do we use a different width (555), but that is only for tests.

Can we switch to using width 700?

manuel garcia’s picture

Re #59 - thanks @chr.fritsch for checking, great to hear that is now fixed :)

chr.fritsch’s picture

StatusFileSize
new7.17 KB
new1.69 KB

Sure, I updated the patch

Status: Needs review » Needs work

The last submitted patch, 62: 2253257-62.patch, failed testing. View results

manuel garcia’s picture

Thanks @chr.fritsch - that test failure:

1) Drupal\Tests\views\Kernel\Plugin\RowRenderCacheTest::testAdvancedCaching
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'  EditDelete'
+'  EditDelete'

+++ b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php
@@ -181,7 +183,7 @@ protected function doTestRenderedOutput(AccountInterface $account, $check_cache
-        '<li><a href="' . $node_url . '/delete?destination=/" hreflang="en">Delete</a></li>' .
+        '<li><a href="' . $node_url . '/delete?destination=/" class="use-ajax" data-dialog-type="modal" data-dialog-options="' . Html::escape(Json::encode(['width' => 'auto'])) . '" hreflang="en">Delete</a></li>' .

I'm guessing we should also change the width here, sorry forgot to mention earlier. Not entirely sure it's why the test is failing though, so we'll see...

chr.fritsch’s picture

Status: Needs work » Needs review
StatusFileSize
new7.17 KB
new1.12 KB

Fix tests

k4v’s picture

For me, this works on the entity list, but not on the entity edit form...

Ah maybe it works only for admin theme routes?

manuel garcia’s picture

Thanks @chr.fritsch, that was it then :)

@k4v this issue is for the entity operations links only, which in core are only used on the entity list pages (collection routes). It should work anywhere you use this via views as well.

I can find no other issues with the latest patch, so RTBC++

bojanz’s picture

Implementation looks good to me.

Only nitpick:

+    // Should still be on the listing page.
+    $this->assertSession()
+      ->addressEquals(Url::fromRoute('entity.entity_test.collection')
+        ->getInternalPath());
+    $this->assertSession()
+      ->pageTextContains(t('The test entity Test entity 3 has been deleted.'));

It's weird to me to see method calls broken down into multiple lines, especially when the indentation in the first case doesn't even match. Guessing it was done automatically by phpstorm, and then not corrected.

Feel free to ignore this if core is fine with such a style.

manuel garcia’s picture

Status: Needs review » Needs work

Good point @bojanz - I don't believe this is valid?

borisson_’s picture

Status: Needs work » Needs review
StatusFileSize
new1.3 KB
new7.18 KB

Improved the nitpick mentioned in #68.

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Great!

manuel garcia’s picture

Awesome thanks all!

@k4v re #66 - I've just realized that we are already working on the entity edit form delete link, see #2254935: Use a modal for content entity form delete links confirmation forms

lauriii’s picture

Issue tags: +Needs usability review
andrewmacpherson’s picture

Just noticed this has RTBC. Some manual a11y testing will be a good idea here, to avoid a serious regression. We're using an existing pattern so hopefully it'll be fine, but I'd like to check everything is wired up correctly here, labels make sense, etc.

vipul tulse’s picture

Assigned: Unassigned » vipul tulse
vipul tulse’s picture

Assigned: vipul tulse » Unassigned

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 70: 2253257-70.patch, failed testing. View results

jibran’s picture

Category: Feature request » Task

Can someone please move commit credits here from #1842036: [META] Convert all confirm forms to use modal dialog?

jibran credited jessebeach.

jibran credited pfrenssen.

jibran credited zvischutz.

jibran’s picture

@lauriii pointed out in slack that I can do it myself. As the initial version of this patch was posted in #1842036: [META] Convert all confirm forms to use modal dialog so I went ahead added the patch contributors from there to this issue.

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.

andrewmacpherson’s picture

Issue tags: +Needs reroll
andrewmacpherson’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new7.22 KB

Status: Needs review » Needs work

The last submitted patch, 87: 2253257-87.patch, failed testing. View results

chr.fritsch’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new7.22 KB
new814 bytes

Moving back to RTBC, because this patch just got rerolls sincs #70 and I changed EntityListBuilderTest to use WebDriverTestBase now.

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs review

This is still tagged as needing usability and accessibility review, and I don't think that happened since being requested in #74. So ticking back for now, sorry.

The last submitted patch, 70: 2253257-70.patch, failed testing. View results

chr.fritsch’s picture

oh true, sorry about that.

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.

aaronmchale’s picture

Status: Needs review » Needs work
Issue tags: -JavaScript +JavaScript, +Needs screenshots, +Needs issue summary update

Not much activity on this in a while, are people still interested in this? To me it sounds like a good idea.

I'm happy to schedule this in for a UX Call, but we'd want some up-to-date screenshots in the issue summary (there are ones early in the issue but they use old styling).

Issues summary also generally needs an update with more description and using the templates.

Thanks.

vsujeetkumar’s picture

StatusFileSize
new7.22 KB
new7.22 KB

Re-roll patch given for 9.3.x, Remains Need Work because of #98

vsujeetkumar’s picture

Both the patches are same, By mistake added, Please ignore.

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new7.31 KB
new783 bytes

Added "$defaultTheme" and "void return typehint for ::setup()" in EntityListBuilderTest file.

Status: Needs review » Needs work

The last submitted patch, 101: 2253257-101.patch, failed testing. View results

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.

tim.plunkett’s picture

Issue tags: +Field UX
hooroomoo’s picture

StatusFileSize
new7.3 KB
hooroomoo’s picture

StatusFileSize
new7.25 KB
hooroomoo’s picture

Status: Needs work » Needs review

Rerolled and updated test in patch in #108

nayana_mvr’s picture

StatusFileSize
new254.26 KB
new343.5 KB

Verified the patch #108 and tested it on Drupal version 10.1.x. The patch works fine and I have added the before and after screenshots for reference.

sonam.chaturvedi’s picture

StatusFileSize
new490.67 KB

Verified and tested patch #108 on 10.1.x-dev and patch applied cleanly.

Test Result:
1. Links to delete entities via operation links open as a confirmation model with "Delete" and "cancel" buttons - works fine for config entities (content type, menus, taxonomy, custom blocks), terms and node content.
2. When we delete menu link via operation link (/admin/structure/menu/manage/test-menu) then it opens a new page. Expected is that this should open in a modal similar to terms and node.
Please refer attached after screenshot of menu link.

I see title says "config entities" but in #2254935: Use a modal for content entity form delete links confirmation forms it is mentioned that delete entities via operation links irrespective of config or content to be handled in this issue #2253257.

The title of this issue was updated in #54 to use "config entities", which IMO is incorrect. Please correct me if I am missing anything here.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new86 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. 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.

dpi’s picture

There are still many needs tags on this issue.

-

It wasnt clear skimming the issue how I would be able to opt out of this behavior, in case a contrib module or site specific functionality enhanced the delete form with more UI. It wouldn't be ideal if we changed this to a modal making existing UI unusable.

At least, we should describe ways in code to override this in a change notice.

hooroomoo’s picture

Issue tags: -Needs screenshots

Screenshots provided in #110 so removing tag

hooroomoo’s picture

Issue summary: View changes

tim.plunkett credited olli.

tim.plunkett’s picture

Title: Use a modal for config entity delete operation links » Use a modal for entity delete operation links
hooroomoo’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update
smustgrave’s picture

Status: Needs review » Needs work

So going to give my best accessibility review

Clicking delete content type the modal opens (Assuming the modal has been tested enough it passes)
Focus is on the X button of the modal
Tabbing takes me through all the elements
Focus stays within the modal.

But the modal does not open when deleting a field.

mgifford’s picture

Last anyone on the accessibility team gave this a review was when @andrewmacpherson looked at it 5 years ago. His summary at the time was that it needed a manual review when it was good to go.

As he pointed out at the time, this is a pattern we're already using and testing elsewhere.

@smustgrave So with your review of the content type, I assume that there is no problem closing the modal. I can't see there being links or other focusable elements aside from the "Delete" & "Cancel" buttons.

What about your report about the modal not opening when deleting the field. Is that a new issue, or something needs to be fixed & then re-tested here.

Generally this looks good though. Thanks for doing the keyboard-only testing for this.

bnjmnm’s picture

Issue tags: +Needs followup
StatusFileSize
new107.83 KB

Re #122

But the modal does not open when deleting a field.

That is not in the scope of this issue. There is a separate issue for that: #2880003: Use modals on the Manage Fields page.

When using this feature on content with translations, there is a contrast issue with the "delete all translations" button. In Claro theme.css loads after button.css, so theme's .ui-widget styling overrides the button.css button's background color but not the text color, so it winds up white text on a light gray background.

While this is not due to the changes here, landing this as-is would increase the likelihood of users encountering this accessibility bug. This can probably be best addressed in a followup that postpones this issue, but if there's a good argument for addressing it here that's an option. If the work is done here, the "Needs followup" tag can be removed.

aaronmchale’s picture

Re comment #124, I would strongly suggest that we fix that bug first, even if it's not caused by this issue we would be making the user experience worse by committing this without fixing that problem, so I would definitely support postponing this issue on fixing that bug first.

narendrar’s picture

StatusFileSize
new541.35 KB
new792.54 KB
new612.77 KB

I tried to reproduce issue mentioned in #124, but it worked well for me.
Please see attached screenshots.

bnjmnm’s picture

Re #126

I tried to reproduce issue mentioned in #124, but it worked well for me.
Please see attached screenshots.

I added testDeleteModal() to Drupal\FunctionalJavascriptTests\Theme\ClaroViewsBulkOperationsTest to confirm that this is happening. Creating that test also exposed the fact that the modal does not work if toolbar isn't present. I suspect this is because the drupal.ajax library is not loaded unless that is the case.

The testDeleteModal() test can probably stick around in some form, be it in this issue or another one, but I could see it changing a bit when it becomes test coverage to confirm functionality instead of its current role as coverage to prove a problem exists.

bnjmnm’s picture

I think the problem can be addressed if core/drupal.dialog is added on page load instead of when the delete button is pressed. When that library is invoked on AJAX request it reloads Claro's theme.css because it is in the definition of a library that is not yet present. That CSS file is appended as the last item in <head>, and takes precedence over Claro's button styling due to appearing after the button CSS. The asset has a lower weight, but when it's added via AJAX that isn't taken into account.

narendrar’s picture

Status: Needs work » Needs review
Issue tags: -Needs followup

Addressed feedback raised in #122 and #124.

smustgrave’s picture

Status: Needs review » Needs work

#124 mentioned the delete field was out of scope and covered in another ticket. That change should be reverted.

Unless the scope of this issue is being expanded

narendrar’s picture

Status: Needs work » Needs review

Addressed #130.

borisson_’s picture

The latest change includes things that should not appear in the MR.

bnjmnm’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Re #130

#124 mentioned the delete field was out of scope and covered in another ticket. That change should be reverted.

That's not accurate. When you mentioned "But the modal does not open when deleting a field." I said that was out of scope as deleting a field is not in scope. This whole issue is about creating modals for delete link confirmation forms, it's just specific to content entities, so fields are not included in that scope.

The latest change includes things that should not appear in the MR.

I'm not spotting any of this - could you add some comments on the MR?

****************************************************************************************
This needs an issue summary update, whether or not the scope changes here.

Although it's not the current scope, there may be benefits to including field deletion in this issues scope, and such a change was discussed. Were that to change, the issue summary should be updated and. If that doesn't change, the issue summary should still be updated because the screenshot there is a confirmation modal of a field being deleted, not a content entity. The screenshot is fine if the scope is broadened, but should be replaced if not.

borisson_’s picture

I clicked on the compare with previous version link, and saw changes in settings.php (https://git.drupalcode.org/project/drupal/-/merge_requests/3700/diffs?di...) I can't see it in https://git.drupalcode.org/project/drupal/-/merge_requests/3700/diffs, so that comment can be scratched.

narendrar’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Updated IS. Added note about #133

bnjmnm’s picture

Issue summary: View changes
narendrar’s picture

Status: Needs work » Needs review
bnjmnm’s picture

Status: Needs review » Needs work

There needs to be FunctionalJavascript test coverage for both the field and entity delete links. The only thing that resembles that is a test I added to ClaroViewsBulkOperationsTestto prove that #124 was in fact happening. Much of that can probably be repurposed to create the tests for the two delete modals, but the functionality should get test coverage, that isn't in the tests for a specific theme, and that actually deletes something as part of the tests (the test I wrote is just proving a button looks bad).

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

utkarsh_33’s picture

Status: Needs work » Needs review
utkarsh_33’s picture

smustgrave’s picture

Status: Needs review » Needs work

On the one thread

I think we should also attach this library to the entity form.

Can that still happen please.

utkarsh_33’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Left a question about a missing test.

utkarsh_33’s picture

Status: Needs work » Needs review
bnjmnm’s picture

This probably shouldn't go in until #3359494: Focus is lost on dialog close if the opener is inside a collapsible element lands, but I don't want to set this to postponed as it's still fine to review this. The one thing a reviewer should note, however, is right now focus will be lost on modal-close if that modal was opened with something inside a dropbutton. That will be fixed by the aforementioned issue.

hooroomoo’s picture

Status: Needs review » Needs work
minnur’s picture

utkarsh_33’s picture

Status: Needs work » Needs review

Addressed all the feedbacks.

bnjmnm’s picture

Status: Needs review » Needs work

Left feedback in MR of additional things that need doing.

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.

utkarsh_33’s picture

Status: Needs work » Needs review

Addressed all the feedbacks.

bnjmnm’s picture

Version: 11.x-dev » 10.1.x-dev
Status: Needs review » Needs work
Issue tags: -Needs accessibility review

This seems pretty close. It looks like one of the reviews asked to move the test coverage for content type deletion but it wound up getting removed instead. That should probably get a home somewhere in the test coverage and this might be ready to go after that, but at that point we may have to postpone on #3359494: Focus is lost on dialog close if the opener is inside a collapsible element as I wouldn't want to add all these modals without focus going to somewhere logical when the modal closes.

Speaking of focus management... As long as #3359494 is taken care of then this passes accessibility review. This doesn't introduce anything that hasn't already been vetted in other confirmation dialogs within core, and I put it through additional manual tests to confirm there was no new surface for problems & that the page-titles-now-dialog-titles still make sense.

smustgrave’s picture

Should this remain in 11.x to be backported?

bnjmnm’s picture

Should this remain in 11.x to be backported?

Technically yes, good call. I want to do it a little differently because this was started pre-11 and has a bunch of threads.

The MR is against 10.1.x and it can get ugly bumping up an MR against version that didn't exist when the fork was created. Sometimes it's necessary to just start a new MR that wipes out the threads. Fortunately it won't impact the review process as nothing here is fundamentally different in 11.x with the files being changed. If we can delay the 11-ifying until a pretty solid RTBC, the switch is a little more painless

lauriii’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs usability review

I added the content type delete operation test coverage to the node module since it's essentially provided by the node module, and doesn't have a dependency on other modules. I decided to reuse the \Drupal\Tests\node\FunctionalJavascript\NodeDeleteConfirmTest since it seems a bit overkill to have a separate test class for node type delete confirmation. Also, the set-up would be nearly identical for these two.

I tagged this for needs usability review 5 years ago. We have been running many iterations of user interviews this spring where we have converted existing forms to modal dialogs and the feedback has been positive there. I don't think this needs further investigation so reverting the tag.

bnjmnm’s picture

Version: 10.1.x-dev » 11.x-dev
StatusFileSize
new14.45 KB

Had an 11x branch ready to push but Gitlab does not appear to be working so here's the 11x in classic patch format.

  • bnjmnm committed 5406b836 on 11.x
    Issue #2253257 by Utkarsh_33, bnjmnm, hooroomoo, jhedstrom, Xano,...

  • bnjmnm committed bab4e144 on 10.1.x
    Issue #2253257 by Utkarsh_33, bnjmnm, hooroomoo, jhedstrom, Xano,...
bnjmnm’s picture

Version: 11.x-dev » 10.1.x-dev
Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

When this issue was created, the top movie in the US was "Captain America: The Winter Soldier"

Today we witness "Issue 2253257: Committed to 11.x and cherry-picked to 10.1.x". Stick around after the issue credits for a sneak peek at some character that will appear in the next commit!

andypost’s picture

Will it have change record or release notes mention?

aaronmchale’s picture

This is a really great UX improvement, it would be nice to highlight this in the release notes.

Well done everyone!

mstrelan’s picture

Status: Fixed » Active
StatusFileSize
new129.76 KB

This is really broken on ajax views. Deleting an entity from the second page of the view takes me to the following path:

/admin/content?page=1&ajax_page_state[theme]=claro&ajax_page_state[theme_token]=OUqFxWhAOwXtkRPcSAdL4jbOuw8Cz4O-QlNSqWuM82c&ajax_page_state[libraries]=big_pipe/big_pipe%2Cclaro/drupal.nav-tabs%2Cclaro/global-styling%2Ccontextual/drupal.contextual-links%2Ccontextual/drupal.contextual-toolbar%2Ccore/drupal.active-link%2Ccore/drupal.dropbutton%2Ccore/drupal.tableheader%2Ccore/drupal.tableresponsive%2Ccore/drupal.tableselect%2Ccore/normalize%2Cshortcut/drupal.shortcut%2Csystem/admin%2Csystem/base%2Ctoolbar/toolbar%2Ctoolbar/toolbar.escapeAdmin%2Ctour/tour%2Cuser/drupal.user.icons%2Cviews/views.ajax%2Cviews/views.module.

lauriii’s picture

Issue summary: View changes
StatusFileSize
new165.28 KB

I tried enabling ajax views and delete node on the second page and it's working 🤔

lauriii’s picture

StatusFileSize
new973 bytes

@mstrelan I still can't reproduce the bug you reported :( Could you by any chance try if the regression gets addressed by this diff?

mstrelan’s picture

@lauriii it seems to only happen with big pipe enabled. Full steps to reproduce:

  1. Install Drupal 11.x with standard profile - commit hash 18432dacb5
  2. Enable ajax on the /admin/content view
  3. Create one article node
  4. Visit /admin/content and apply a filter (e.g. Type = Article)
  5. Delete the article

Applying the patch was slightly better, but I was redirected to the front page instead of back to the admin content view.

FWIW I tested first with a custom docker compose setup and again with ddev default config for Drupal 10.

lauriii’s picture

StatusFileSize
new612 bytes

I could reproduce the problem you mentioned on #167 with #166 but I still can't reproduce #164.

My hypothesis is that there's something wrong about the libraries on the page. Here's another issue which tries to make loading the libraries more consistent. Could you test if this has any impact on #164?

lauriii’s picture

Status: Active » Fixed

With the help of #167, I was able to reproduce this now. The bug reported in #164 is not actually caused by this issue but #956186: Allow AJAX to use GET requests. I'm marking this as fixed since that regression is not made better or worse by this issue.

We may still want to commit something along the lines of #168 though because it addresses some dialog styles in Claro.

lauriii’s picture

Status: Fixed » Closed (fixed)

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