Active
Project:
Drupal core
Version:
main
Component:
forms system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
15 Nov 2012 at 21:36 UTC
Updated:
18 Apr 2024 at 15:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rvilarI want to help in this issue. We're in a Drupal8 sprint in Barcelona and if I can, I want to help on this issue.
I'll look at #1667742: Add abstracted dialog to core (resolves accessibility bug) and post a patch in a while
Comment #2
finn lewisI'm also interested in this, but could not work out how to see an example of modal dialog being used in the admin UI.
I read through http://drupal.org/node/1667742 and can see that has been committed.
Are there examples of modal dialogs in the admin UI that I should be able to see now?
Comment #3
jibranI am going to work on this list http://api.drupal.org/api/drupal/core%21modules%21system%21system.module....
Comment #4
effulgentsia commentedNo. We ended up removing it from the scope of that issue. But here is what we had there before removing it. This adds it to node deletion (both the operations link on admin/content and the button on node/NID/edit).
Comment #5
effulgentsia commentedAlso note, since this is done via Ajax, and Ajax relies on content negotiation, you may find that some of the places in #3 don't work. For example, in the other issue we initially had one of the forum.module forms converted, but it wasn't working correctly. Once we know what the problem ones are, we can fix them to be compatible with Drupal 8 content negotiation. Just mentioning this as a warning so it doesn't take you by surprise.
Comment #6
jibranI have worked on the modules form a-n, remaining are o-v.
I have also converted forum.module but removed it from the patch and created a separate patch for it. I want to know if this is right way or not.
While creating the patch I noticed
$linksare still present in menu.module. so I think it needs follow up.Image module is horrible to see forms are built in theme function. I found #1812684: [meta] Consolidate all table templates and add theme_hook_suggestions which is going to fix it.
Do I have to convert
admin/reports/status/rebuildto modal dialog?I'll update remaining modules in the next patch.
Comment #8
jibranAll the confirm forms are converted.
I have also converted cancel user form but it is not working correctly.

I haven't converted
admin/reports/status/rebuildandadmin/structure/views/view/%views_ui_cache/break-lockbecause both url's are created byurl()function.I have also not converted
views_ui_confirm_deletebecause it start showing to progress indicators.Last patch has failed some tests I might need some help fixing those.
Comment #10
jibranFixed some tests
Comment #12
andypostRelated discussions
#402760: Regression: Turn "delete tabs" back into buttons
#1834002: Configuration delete operations are all over the place
Comment #13
jibranRemaining issues
1. Converted admin/reports/status/rebuild and admin/structure/views/view/%views_ui_cache/break-lock because both url's are created by url() function. I think #1870764: Add an ajax command which makes it easy to use the dialog API in complex cases will fix the issue
2. Convert forum.module and figure out the issue. see #5 for detail.
Followup issues
1. menu.module required cleanup. $links are still present in menu.module
2. Fix views bug in #8 so adding VDC tag.
Comment #14
dawehnerFixed the follow up in the views code.
out of scope: We could open a follow to rename this to delete to be more consistent: #1878302: Use 'delete' over 'remove' in the aggregator module
We maybe should explain why this was done in a short comment.
We should maybe discuss whether we should inline this second array.
Jibran suggested to convert the break-lock to use the modal. In general i'm not 100% sure whether we can use an ! placeholder when we really need fancy handling of theme_link/l().
Comment #15
xjmI think the current array format is fine. Either way works. This way it is nicely scannable.
Comment #16
jibranIn this patch
Added comment.
Converted
admin/reports/status/rebuildto modal dialog.Remaining task
Figure out
forum.moduleissue and find out the solution. See #5 for detail. Patch attached in #6.Comment #17
dawehnerSo ... the actual question I have here is why? The tests will probably don't test that right? Btw. multiple spelling mistakes here :)
Comment #19
dawehner#16: confirm-forms-to-use-modal-dialog_1842036-16.patch queued for re-testing.
Comment #20
jibranComment fix.
Comment #21
dawehnerwhat about "in a modal dialog, so remove #ajax".
Do we have a confirmation of the UX team that all these different places should use modal dialogs?
Comment #22
jibranUpdated the comment
Comment #23
dawehnerSo cool to see all these modals, though someone from the UX team should give a go.
Comment #24
falcon03 commentedtagging
Comment #25
sunI don't understand this —
1) The mere existence of #ajax doesn't make the delete link unusable without Ajax/JS.
2) Tests are actually able to test Ajax operations via drupalPostAjax().
So why is #ajax removed here?
Aside form that, the patch looks good to me. I'd recommend to go ahead and do actual/real user testing among core developers in HEAD; i.e., just commit it, and see how it goes. We can always revise later.
Comment #26
jibranThanks @sun for correcting my mistake of course I didn't know about drupalPostAjax. I was just trying to fix the test. New patch with drupalPostAjax. And removed.
Comment #27
tstoecklerThis change is not compatible with translatability. As it is done before, we should spell out the < a > tag completely. If that is considered to be too verbose, let's just leave that out of this patch and discuss it in a follow-up.
Comment #28
jibranCurrently modal dialog doesn't have complete test coverage so while using drupalPostAjax mentioned in #25 I ran into 1 exception
Undefined index: callbackin #26 so created this #1884530: Complete modal dialog tests. and postponing it till #1884530: Complete modal dialog tests. is fixed.Comment #29
jibran@tstoeckler
I have also done it for rebuild permission link so should this also be reverted?
Comment #30
tstoecklerI must have missed that. Yes, that should be reverted. The entire < a > tag should be part of the t() call.
Comment #30.0
jibranUpdated issue summary.
Comment #30.1
jibranFormatting
Comment #31
jibranTagging.
Comment #32
jibranDuplicates #617730: UX: Use modal dialogs for confirmation forms. #114546: Confirmation alerts done with JS/AJAX (delete confirmation page and any others)
Comment #33
jibranPostponed on #1870764: Add an ajax command which makes it easy to use the dialog API in complex cases
Comment #34
jibranPostponed on #1944472: Add generic content handler for returning dialogs as per #1870764-98: Add an ajax command which makes it easy to use the dialog API in complex cases
Comment #34.0
jibranUpdated issue summary.
Comment #35
klonosOver in #1834002: Configuration delete operations are all over the place there's debate over removing the delete tab and reverting back to #402760: Regression: Turn "delete tabs" back into buttons. It's often mentioned as a drawback of removing the delete tab that the delete action would be destructive. People seem to be concerned by the possibility of accidental clicks on the delete button.
Those of us familiar with this issue here reassure people that there'll be a confirmation dialog on delete and actually point them here. We tell them that instead of it being a separate page/tab it'll now be a modal. How do we fall back though when there's no java enabled in browsers?
Comment #36
effulgentsia commentedOnce #1944472: Add generic content handler for returning dialogs lands and this issue's patch is rerolled for it, it should be the case that without JS, the same confirmation form that is otherwise displayed in a modal, just gets displayed as a full html page. Nothing special needs to be done for that: that's the magic of that issue.
Comment #37
andypostThere's a nice table of all confirm forms #1945406: [meta] Convert all of confirm_form() to ConfirmFormBase most of them are entity-related. So the only question here - what would be displayed in breadcrumbs for fallback (none-js) pages? Once #1834002: Configuration delete operations are all over the place removes all Delete tabs so the only possible way to use "cancel-url" from confirm form
Comment #38
klonos#1960928: Provide an opt-out modal confirmation when saving changes to content that is not configured to hold revisions.
Comment #39
yched commentedPeople have been trying to help with #1946404: Convert forms in field_ui.admin.inc to the new form interface, but stumbled on the corresponding menu items currently being defined in a foreach, and thus the need to go through RouteSubscriber / RouteEnhancer (or something :-)).
Any knowledgeable people to provide docs or code pointers on the correct way to leverage that over there ?
Comment #40
jibran#1944472: Add generic content handler for returning dialogs is in.
Comment #41
effulgentsia commentedThe first step here is to reroll #26 so that it applies to HEAD. Additionally:
These should all be replaced with:
There'll be more to do to make it all work, including the follow up mentioned at the end of #1944472-70: Add generic content handler for returning dialogs, but getting an up to date patch here will help a lot in having some concrete stuff to work with in doing that. It might even make sense to do the _form controller work as part of this issue, since this issue provides such a great set of simple use cases for it.
Comment #42
aspilicious commentedWith all the confirm forms beign converted to configformBase form handler I don't think this is the right moment to reroll this... Nothing from the original patch applies as most forms are already converted to the new forminterface...
What do you expect in this reroll?
Comment #43
jibranThis patch is doing nothing with confirm forms. It is just showing confirm forms in model dialog. Only thing relevant to confirm forms is
which is moved to ConfirmFormBase and I don't think we need this anyway.
I am going to re-roll the patch so assigning to me myself. @effulgentsia thanks for explaining the changes.
Comment #44
larowlanWe may need to make sure form enhancer runs before dialog enhancer...
Comment #45
jibranHere is a re-roll.
Comment #47
larowlancan we use #attached instead?
Comment #48
gábor hojtsyTrying this out on simplytest.me, I'm getting:
POST http://s0d9f94d237feb49.s3.simplytest.me/admin/structure/contact/manage/... 404 (Not Found)
POST http://s0d9f94d237feb49.s3.simplytest.me/admin/structure/custom-blocks/m... 415 (Unsupported Media Type)
POST http://s0d9f94d237feb49.s3.simplytest.me/admin/structure/taxonomy/manage... 415 (Unsupported Media Type)
POST http://s0d9f94d237feb49.s3.simplytest.me/admin/structure/views/view/fron... 404 (Not Found)
So a mix of 404 and 415, no dialogs whatsoever showing up.
Comment #49
larowlanHave been working on this
Comment #50
larowlanSo this adds some extra changes to dialog enhancer to allow it to work with _form routes.
These dialogs definitely need some elements set like width.
Also this patch can't go-in until all of the delete form paths use routes instead of hook_menu() so we should probably postpone on #1971384: [META] Convert page callbacks to controllers or split it up into distinct patches as routes are converted.
And finally, here's a screenshot of it in action on the aggregator feed delete form - demonstrating that we need to add some widths to some of these dialogs.

Comment #51
tim.plunkettThis FALSE looks odd, could probably just be NULL
Could/should this be ->has() instead? Not sure if it matters
Comment #52
larowlanBack to jibran
Comment #53
Crell commentedThat seems like a dangerous assumption. Instead, since we have $request here we can just check it directly for _content, _form, etc. and remove $_content from the method signature entirely.
This minorly conflicts with #1988666: Cleanup Controllers and Enhancers, but that should be resolvable.
Comment #54
larowlanAgreed on the $_content and $_form, good catch
Comment #55
yched commentedIs the reasoning that the form needs to specify some width so that the title doesn't get truncated ?
Problem is the texts are going to be translated, and the resulting string length will vary greatly depending on the language, so thre's no "reasonable assumption" to be made in code about the width. I'd say we just can't have an output for our popups that truncates strings if they don't fit ?
(not to say that being able to.specify widths wouldn't be otherwise nice)
Comment #57
yched commentedFYI: #1993518: Display batch progress in modals ?
Comment #58
jibranThanks @larowlan for working on it. As per #50 this is postponed on #1945406: [meta] Convert all of confirm_form() to ConfirmFormBase.
Comment #59
Bojhan commentedI would not postpone this on conversions anymore, anything we want to get in - we need to get in now. Conversions or not. And we can easily pass on certain interfaces, that are not yet converted - the majority are.
Comment #60
effulgentsia commentedI agree with #59. There's enough converted forms already in HEAD to make this worth getting in and tested by more people. After this is in, we can update #1945406: [meta] Convert all of confirm_form() to ConfirmFormBase with instructions to also modalize the remaining ones as part of their conversions to ConfirmFormBase.
Comment #61
larowlan#1988666: Cleanup Controllers and Enhancers is in - this needs a re-roll
Comment #62
larowlanRe roll post #1988666: Cleanup Controllers and Enhancers
Comment #64
wim leersOn the "setting width" aspect that's been mentioned several times now: can't it just be smart and auto-adjust the width to fit the title? Alternatively, can't the title be wrapped over multiple lines?
Comment #65
jibranworking on #60
Comment #66
jibranI have replaced
So all links are now showing in modal dialog weather converted to routes or not. The only downside to this approach is that we can't use
data-dialog-options.IMO for FAPI #ajax we should add
'dialogOptions'key somthing like thisKnown Bug
admin/reports/status/rebuildis not showing in modal related issue #1946434: Convert all of confirm_form() in node.admin.inc and node.pages.inc to the new form interface.This is not working for delete buttons. For buttons see diff of
search.admin.incin the patch.
admin/structure/typesdropbutton delete link is not working.Comment #68
jibranUnassigning and setting to CNR to get some assistance because I am unable to figure out test failures.
Comment #69
panchoSome more converted confirm forms: #1946454: Convert all confirm_form() in system.module and system.admin.inc to the new form interface and convert route
Comment #70
larowlanSee also #1998698: Allow Dialog Controller to work with form/entity form routes
Comment #72
jessebeach commented#66: modal-confirm-1842036.66.patch queued for re-testing.
Comment #73
jessebeach commentedThe failed tests in #66 came back green locally, so I spooled them up for a retest.
Comment #74
jessebeach commentedSorry, I'd rerolled the patch in #66 locally because it wasn't applying any more. I then retested it locally and the tests returned green, so here's the reroll that should pass.
Comment #75
dawehnerThis hardcodes stuff, so I'm not sure whether this is really the right approach.
Comment #76
jibranReuploading #74 to test.
Comment #78
jibranhttp://qa.drupal.org/pifr/test/527323 and http://qa.drupal.org/pifr/test/525543 both has
FAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to checkout from [git://git.drupal.org/project/drupal.git].same error.Uploading a re-roll.
Comment #80
jibran#78: modal-confirm-1842036.77.patch queued for re-testing.
Edit: I am able to clone drupal normally.
Comment #82
jibran#78: modal-confirm-1842036.77.patch queued for re-testing.
Comment #84
andypost#78: modal-confirm-1842036.77.patch queued for re-testing.
Comment #85
dawehnerOn #1983164: Entity Forms in ajax requests don't find the route I started an approach for entity forms which are called by a subrequest of AjaxController which maybe would be also capable to solve this problem here.
Comment #86
larowlan@dawehner, please review #1998698: Allow Dialog Controller to work with form/entity form routes where the hard-coding is removed (different approach)
Comment #87
larowlanStraight re-roll.
Note that old paths still don't work (only new routes).
Also to control the ajax width - this works - tested with EntityListController and contact categories.
Comment #88
larowlanComment #90
yesct commented#1988716: Convert delete confirm to AJAX dialog for config_translation is postponed on this.
I *think* the remaining tasks in the issue summary are still up-to-date.
Comment #91
jibranWe are almost done #1945406: [meta] Convert all of confirm_form() to ConfirmFormBase other then #1938318: Convert book_remove_form to a new-style Form object which is block on #1947880: Replace node_access() by $entity->access(). I'll reroll the patch soon.
Comment #92
jibranHere is the reroll.
Comment #94
pfrenssenFixed a failing test.
Comment #96
pfrenssenI looked into the test failures but they are occurring on a spot where there are no confirmation forms used. When trying to replicate them manually I was constantly hitting #1831846: Help block is broken with language path prefixes, and in that issue these tests are being reworked.
Comment #97
pfrenssenThis might be related to the test fails, before things start going haywire an error message appears when a translation is marked as outdated: #2087299: Impossible to save nodes if translation is newer than default language. This also happens without this patch applied, but it seems like the entity is in an unexpected state for most of the remaining test.
Comment #98
tstoeckler#94: drupal8.forms-system.1842036-94.patch queued for re-testing.
Comment #100
Bojhan commentedNo idea what to evaluate.
Comment #100.0
Bojhan commentedUpdated issue summary.
Comment #101
klonosComment #102
andypostThere's issue to discus about comment edit/delete forms #1902874: Comment delete and edit to open in overlay
Comment #103
gábor hojtsyMarked #1988716: Convert delete confirm to AJAX dialog a duplicate of this issue, since the config translation module (that that issue belongs to) is now in core, so this patch would need to cover that.
Comment #104
andypostComment #105
zvischutz commentedThis is a re-roll of previous patch (#94) to current (20/12/2013) drupal 8 version
Comment #106
zvischutz commentedComment #108
martin107 commentedLooking at the failure reported by testbot ... I cannot reproduce .. restesing
php core/scripts/run-tests.sh --verbose --file ./core/modules/image/lib/Drupal/image/Tests/ImageEffectsTest.php
Drupal test run
---------------
Tests to be run:
- Image effects (Drupal\image\Tests\ImageEffectsTest)
Test run started:
Sunday, December 22, 2013 - 17:44
Test summary
------------
Image effects 41 passes, 0 fails, and 0 exceptions
Test run duration: 7 min 5 sec
Comment #109
martin107 commented105: drupal8.forms-system.1842036-105.patch queued for re-testing.
Comment #110
pfrenssenStraight reroll.
Comment #112
pfrenssenGoing to work on this.
Comment #113
pfrenssenCannot replicate the test failure locally. Updated the patch with the delete confirmation dialog from #1988716: Convert delete confirm to AJAX dialog as per comment #103.
Comment #114
Crell commentedIf the goal is that confirmation forms should all, by default, be modals, we shouldn't force people to remember to set this seemingly obscure marker every time. Is there some way we can add an affordance so that it happens by default if someone does something more "obvious"? Eg, a way to recognize a confirmation form link, or a way to simply flag "modal" rather than setting the accept mime type directly, or something along those lines?
(I at the moment have no opinion about whether confirmation forms SHOULD all be modals; I leave that decision to the UX team.)
Comment #115
dawehnerI really like the idea proposed by crell, as we should not expose those really deep level details in our public apis like that.
As long we don't require people to use modal => TRUE (or something similar) this is not even an API change but an addition.
Comment #116
tstoecklerdrupal_add_library() should no longer be used, see #2171071: Rename drupal_add_library() to _drupal_add_library() and remove its uses. Instead we should use something like
(Probably with less whitespace than that :-))
Comment #117
pfrenssen@dawehner, #modal => TRUE is a very nice idea, would love that :D
Comment #118
dawehnerJust a rerole. We indeed hat #ajax][dialog at some point already.
Comment #119
dawehnerJust a rerole. We indeed hat #ajax][dialog at some point already.
Comment #122
jibranSome more fixes.
Comment #124
alvar0hurtad0Comment #125
alvar0hurtad0Comment #126
internetdevels commentedHi! I've investigated this issue and found that problem is somehow related to the form caching after adding ajax to it. For some reason we lose plugin after cache receiving. I tried to figure out why but with no luck, so I've added a small workaround. Maybe somebody can offer better solution:
Comment #127
xano@larowlan and I agreed that instead of re-rolling the last patch, it's better if we split this issue up in multiple smaller ones that target specific contexts. See #2253257: Use a modal for entity delete operation links for the first sub-issue.
Comment #128
andypostSo maybe better to re-title as meta with child sub-issues?
Comment #129
cmanalansan commentedI am removing the Novice tag from this issue because:
I’m using this documentation as a source: https://www.drupal.org/core-mentoring/novice-tasks#avoid
Comment #130
andypostlooks that should go to 8.1
Comment #131
Crell commentedConcur.
Comment #132
pfrenssenWould it be a good idea to add a convenience method to FormBase to detect whether a form is displayed in a modal?
I am using this to hide the "Cancel" link in my confirm forms when they are displayed in a modal. The close button takes the role of cancelling the form.
Since this is a meta issue, should I create a separate child issue for this?
Comment #133
pfrenssenCreated #2661046: Allow forms to easily determine whether they are shown in a modal.
Comment #137
vijaycs85I created a simple utility module at Modal Configuration to make this configuration admin manageable. The main reason for this is, if the site admin/user don't want to have modal, they still be able to opt-out and same way they can add more modal, they can. Its still in very early stage, but can be improved, if we plan to go this route.
Comment #138
Bojhan commented@vijaycs85 From my POV, a contrib module could perfectly provide this configurability - I dont see it necessary to overload core with options like that.
Comment #139
anybodyI think it's a really important UX improvement to have confirmation messages in modals. The new page load every time is very 90's ;) and costs a lot of time. So that part should not be a separate module but core default I think. Just my 2 cent ;) because we just ran into the same discussion.
Comment #141
vijaycs85@Anybody, agreed. but having as a separate module (I don't mind having it incore experimental module, if possible :)) gives option to configuration or disable if some sites decided to.
Comment #142
gagarine commentedUsability is preferred over UX, D7UX, D8UX etc. See https://www.drupal.org/issue-tags/topic
Comment #144
manuel garcia commentedDo we have an issue for doing this to content entities delete operation links?
Comment #145
Syntapse commentedare there any plans to introduce this as a core feature? page loads for confirmations makes drupal feel dated and cumbersome.
is there an easy way to do this if there are no plans to introduce as a core feature?
Comment #149
jibranComment #150
jibranUpdated the title as well.
Comment #157
maskedjellybeanI agree that this would be better UX.
This issue is related but different:
https://www.drupal.org/project/drupal/issues/2883755
I also found this module which I'm surprised hasn't been posted here yet:
https://www.drupal.org/project/admin_dialogs
I haven't tried it yet, but as the time of posting it is maintained.
Comment #158
andypost