Problem/Motivation
In most cases, entity delete confirmation forms are very simple and there's no reason why we should make the user go to a different page just for this.
Proposed resolution
Update all links to the entity delete confirmation form so as to use a modal by default.
Links to delete entities via operation links (for example on the admin/content page) are being handled as a separate issue: #2253257: Use a modal for entity delete operation links.
The scope here is to tackle the rest.
Remaining tasks
Update delete link on entity edit form.Update entity operations delete linkSee #2253257: Use a modal for entity delete operation links- Update Delete tab when viewing the entity.
- 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.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #73 | 2254935-nr-bot.txt | 85 bytes | needs-review-queue-bot |
| #70 | 2254935-70.patch | 7.52 KB | hooroomoo |
| #69 | 2254935-69.patch | 7.92 KB | hooroomoo |
| #66 | interdiff.txt | 932 bytes | lauriii |
| #66 | 2254935-66.patch | 4.69 KB | lauriii |
Comments
Comment #1
xanoComment #2
larowlanLooks like the question isn't coming through as the title.

Comment #3
xanoThat 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.
Comment #4
xanoThis makes sure that long titles are displayed correctly by the modal. However, 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.Comment #5
larowlanNote #2207247: Dialog titles double escaped for views handlers and delete forms
Comment #6
xanoSo is this good to go?
Comment #7
larowlanYes
Comment #8
olli commentedShouldn't this be in the delete link?
Comment #9
xanoYou're right. Thanks for being so observant!
Comment #11
xanoUgh. Another testbot malfunction.
Comment #12
alexpott8: drupal-2254935-8.patch queued for re-testing.
Comment #13
Bojhan commentedI am not a huge fan of confirm dialogs, as they turn into a habit even when it concerns critical messages. However I don't see the current step as a bad thing. I have a few questions:
Comment #14
xanoI have no idea how configuration forms are related to this issue, as they are not entity forms and have no delete links. Can you elaborate on that?
Comment #15
lewisnymanThe confirm dialog is a global component, if it's not mobile friendly yet then we need to fix that globally. It shouldn't affect the decision to use a dialog on a case per case basis.
Comment #16
yoroy commentedDeleting something should follow a consistent pattern, regardless if it's an entity or not. For example, deleting an URL alias has a confirmation step similar to the one for entities:
Comment #17
yoroy commentedLewisnyman: the question is whether a case-by-case approach helps us closer to release. Not sure it does.
Comment #18
xanoThis patch does not remove the confirmation step. It just presents that step as a modal rather than a separate page when people click the Delete link from the entity form (#2253257: Use a modal for entity delete operation links is for the operation link in entity lists). Is this what you mean? I just want to make sure since there has been some confusion.
If this is what you mean, do you have any suggestions? Should we keep confirmation pages for deletion workflows, or should we implement modals across the board straight away?
Comment #19
yoroy commentedUnderstood that the confirmation step stays. I meant to say that *the process of deleting something* (entity or whatever) in the UI should follow the same pattern. Moving it into a modal for only some of the delete operations makes it less consistent.
I have no objections to the use of the modal itself. Just cautious to apply it only in some places, some not.
Comment #20
yoroy commentedOk, so best next step seems to be to get a list of the non-entity delete forms in core that would not be touched by this patch so that we can see how many exceptions we'd introduce and assess how bad that might be.
Comment #21
xanoAgreed.
Comment #22
xanoI listed all occurrences at #1842040-8: [meta] Decide on where to use modal dialogs.
Comment #28
rolodmonkey commentedSince the parent issue is for 8.4, I am updating this one to be the same.
Comment #29
vijaycs85Re-roll against 8.4.x.
Comment #30
vijaycs85Also the space between the delete link and loading icon seems bit too much. Attaching screenshot.
Comment #32
vijaycs85Updating test fail.
Comment #33
droplet commentedJot a quick note:
I think we need to test nested Modal with this new feature.
Comment #35
manuel garcia commentedFixing the failing tests, and expanding a bit the tests on there to check for the modals.
Re: #33: I think nested modals are not working in core at the moment, see #2741877: Nested modals don't work: opening a modal from a modal closes the original
Comment #36
vijaycs85Comment #37
vijaycs85Comment #38
yoroy commentedOne quick note is that this only seems to work from the delete link while already editing the thing. There's a "Delete" tab on the front-end view of content items where I'd expect the same behaviour but no modal there (yet).
Comment #39
manuel garcia commented@yoroy my understanding is that this issue is for the entity edit form only.
Another place that is not covered by this patch would be the delete link on the operations links (for example on the /admin/content view)
In any case, I agree from a UX perspective that we should do this for any link pointing to a delete entity form so that it is the same expected behavior.
I guess the question is: Should we expand the scope of this issue or not?
Comment #40
rolodmonkey commentedThe other ways to delete content are already being handled in separate issues. Please scroll to the top of this issue and see the parent issue and related issues.
Comment #41
yoroy commentedOnce more proof people don't see things in sidebars :) I see that is covered indeed.
Comment #44
manuel garcia commentedWe've got functional javascript tests covering the functionality introduced, so removing the tags.
Latest patch still applies cleanly, anything else we should be doing here?
Comment #45
manuel garcia commentedWe're standardizing on width 700 for core here, so fixing that. Also moving that to a new line so as to keep the same format as elsewhere in core.
Comment #46
runeasgar commentedTesting.
$ curl -l https://www.drupal.org/files/issues/2018-04-17/2254935-45.patch | git apply -vdrush cr/admin/contentfor good measure: does not work - I still get sent to a page..Looks like this ticket is explicitly for the content entity form screen, so marking this as RTBC because it meets the expectations of the issue title. But, I do wonder if this modal should be available for node (or even more entities) deletes in all contexts.
Comment #47
runeasgar commentedForgot the screenshot:
Comment #48
manuel garcia commentedThank you @runeasgar!
You are correct, this issue's scope is only about the delete link on the entity edit forms.
Comment #49
andrewmacpherson commentedJust noticed this issue and #2253257: Use a modal for entity delete operation links are both RTBC.
Some manual aaccessibility 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.
Comment #50
yoroy commentedFinally got to test this manually again. It's not really a useful change if we introduce two ways this confirmation pattern works. I think we should include the tab (on entity display and dropbutton links (in listings) to do the same. This is a super useful and userfriendly change but we should make this the new default then for all ways you can delete entities. Sorry for not making that call earlier.
Comment #51
manuel garcia commentedYeah you're right @yoroy - let's just expand the scope of this then.
Updating the issue summary and title accordingly.
Comment #52
manuel garcia commentedComment #53
manuel garcia commentedComment #57
manuel garcia commentedRe #50 - the entity operation delete links (ie on admin/content) are being tackled here #2253257: Use a modal for entity delete operation links
Updating the Issue summary to clarify the scope and remaining tasks.
Comment #64
hooroomooComment #65
pooja saraah commentedFixed failed commands on #64
Attached patch against Drupal 10.1.x
Comment #66
lauriiiChanged the operations list to use modal for delete confirmation.
While I did that, I noticed similar issues that @bnjmnm reported on #2880003: Use modals on the Manage Fields page where the focus moved to the window when returning from dialog because the button from toolbar is no longer focusable.
Comment #68
tim.plunkettComment #69
hooroomooFixed failed tests from #66
Comment #70
hooroomooComment #71
hooroomooComment #72
smustgrave commentedAgree this needs accessibility review as it provides a new popup functionality.
Tested #70
When the modal opens the focus goes to the "Delete" button - which is good
Tabbing does not leave the module. "Delete" button -> "Cancel" button -> X button in the corner - while is good
This is the markup of the modal
role = dialog seems correct
aria-describedby and aria-labelledby are the ones I'm not 100% about.
Think accessibility
Comment #73
needs-review-queue-bot commentedThe 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.
Comment #74
mgifford@smustgrave what are the
aria-describedby="drupal-modal" andaria-labelledby="ui-id-1"describing?These are usually very accurate:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attribut...
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attribut...
These might be:
https://benmyers.dev/blog/aria-labels-and-descriptions/
https://cccaccessibility.org/web-1/web-developer-tutorials/aria-labelled...
Comment #75
tim.plunkettThis issue is confusingly similar to #2253257: Use a modal for entity delete operation links. While this is intended for content entities and the other for config entities, there is not currently a split implementation between the two. Both content and config entities rely on
\Drupal\Core\Entity\EntityForm, and the code changes on the two issues are almost identical. The only difference is test coverage.Since this is the "newer" issue and the other one has a more recently updated MR, I'm going to mark this as a duplicate. I will transfer contribution credit over to the other issue.
Comment #76
aaronmchaleThanks @tim.plunkett
From both a code maintainability and usability perspective, the more consistency we have across the admin UI the better.
Comment #77
tim.plunkett