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.
Comment | File | Size | Author |
---|---|---|---|
#51 | 2880003-51.patch | 9.43 KB | lauriii |
#47 | interdiff-2880003-40-47.txt | 1009 bytes | BS Pavan |
#47 | 2880003-47.patch | 9.83 KB | BS Pavan |
#45 | After_patch_screenshot.png | 44.78 KB | vikashsoni |
#42 | After patch rec.mp4 | 3.02 MB | manojithape |
Issue fork drupal-2880003
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
Comment #2
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedHere's a starting point.
Comment #3
bojanz CreditAttribution: bojanz at Centarro commentedFeels 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.
Comment #4
vijaycs85Great 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:
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.
Comment #5
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedRe #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
Comment #6
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commented@bojanz regarding the delete forms, see #1842036: [META] Convert all confirm forms to use modal dialog
Comment #7
vijaycs85Thanks for finding related issues @Manuel Garcia. Few things from related issues:
Comment #8
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedThanks @vijaycs85 for the review!
Comment #9
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedHere'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.
Comment #10
tacituseu CreditAttribution: tacituseu commentedDialogs 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.Comment #12
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedCleaning 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:
Comment #14
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedRe #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.
Comment #15
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedRerolling #12, #2836384: Field UIs operations array is broken for entities with restricted access broke it...
Comment #16
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedComment #18
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedOops, clearly I was going too fast last night.
Comment #20
tacituseu CreditAttribution: tacituseu commentedYou 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.Comment #21
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedThanks @tacituseu, i had a look, and tried to mimic that test, but no luck.
In this patch:
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...
Comment #23
tacituseu CreditAttribution: tacituseu commented@Manuel Garcia: it fails at
$modal = $page->findById('drupal-modal');
I'll investigate why in test issue.Comment #24
tacituseu CreditAttribution: tacituseu commentedIt 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).Comment #25
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedHAH! 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.
Comment #26
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedAppologies, ignore the patch on #25, I forgot to rebase my branch before generating the patch. The interdiff on #25 is correct.
Comment #27
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedFixing the coding standards violation found by the bot.
Comment #36
ranjith_kumar_k_u CreditAttribution: ranjith_kumar_k_u at Zyxware Technologies commentedRe-rolled the last patch for 9.3
Comment #38
vsujeetkumar CreditAttribution: vsujeetkumar at Srijan | A Material+ Company for Drupal India Association commentedFixed some fail tests, Updated functional javascript tests according to drupal 9.3.x standard.
Comment #40
vsujeetkumar CreditAttribution: vsujeetkumar at Srijan | A Material+ Company for Drupal India Association commentedFixed Tests, Please have a look.
Comment #41
manojithape CreditAttribution: manojithape at QED42 for Drupal India Association commentedComment #42
manojithape CreditAttribution: manojithape at QED42 for Drupal India Association commentedVerified and tested patch#40 on the drupal 9.3.x-dev version. Patch applied successfully and looks good to me.
Testing Steps:
Expected Result:
Actual Result:
For reference, please refer to the attached screen recording video.
Move this ticket to RTBC.
Comment #43
KartagisComment #44
Mile23#2088121: Remove Overlay
Comment #45
vikashsoni CreditAttribution: vikashsoni as a volunteer and at Zyxware Technologies commentedApplied patch #40 working fine now i am able to use modals in manage fields for reference sharing screenshot
Comment #46
quietone CreditAttribution: quietone as a volunteer commentedThe 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.
This would be easier to read if on multiple lines.
s/Test/Tests/
Comment #47
BS Pavan CreditAttribution: BS Pavan at Srijan | A Material+ Company commentedMaking the changes as suggested in #46, please check.
Comment #51
lauriiiRerolled #47 to 10.1.x.
Comment #53
lauriiiComment #56
bnjmnmAdded an MR with all tests passing. Left a few things that need addressing in the MR.
Comment #58
hooroomooComment #59
smustgrave CreditAttribution: smustgrave at Mobomo commentedMR 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.
Comment #60
lauriiiThank 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?
Comment #61
smustgrave CreditAttribution: smustgrave at Mobomo commentedLet 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.
Comment #62
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis almost reminds of the overlay module of Drupal 7. Think I got that right.
Comment #63
lauriiiYou'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.
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.
Comment #64
lauriiiOverlay 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 🤔
Comment #65
smustgrave CreditAttribution: smustgrave at Mobomo commentedDon'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.
Comment #66
lauriiiWe 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.
Comment #69
tim.plunkettI 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:
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.
Comment #70
tim.plunkettAll 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
Comment #72
lauriiiConverting 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.
Comment #74
benjifisherIn 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.)