Problem/Motivation
Follow-up on #2253257: Use a modal for entity delete operation links where entity delete operation links were changed to open a modal instead of showing the form on a separate page (using use-ajax on links). This is often helpful and nice, but the current implementation doesn't open the links in a new tab using Ctrl+click or middle mouse button, which is expected and would be very helpful for batch-deleting in tabs.
Using "Open in a new tab" works fine using right mouse click browser context menu. But what doesn't work is using Ctrl+Click or middle mouse button.
I use this very frequently to mass-click such links for example deleting several views fast using tabs. Ctrl+Click should just work as expected and open the link in a new tab.
Similar old Drupal 7 issue: #3565861: Add support for Ctrl + click in Search, or add as setting option?
Steps to reproduce
Use Ctrl+Click or middle-mouse click on Views "delete" links at /admin/structure/views or other places in core where modals are used.
Expected result: Open the confirmation in a new tab
Actual result: Modal loads, no tab opened
Proposed resolution
Ensure expected behavior
Remaining tasks
Test
Release
User interface changes
Introduced terminology
API changes
None
Data model changes
None
Release notes snippet
Issue fork drupal-3592504
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
anybodyComment #3
anybodyI assume this needs to be fixed in
core/drupal.dialog.ajax. Should we move this? For example to component "Javascript"?Comment #5
anybodyI prepared a fix, works like a charm for me and fixes the issue, please review. Efficient editing is back ;)
Comment #6
anybodyComment #7
anybodyComment #8
mstrelan commentedThank you for this, it upsets me greatly when default browser behaviour is broken in an attempt to "simplify" interfaces.
Comment #9
anybodyThank you @mstrelan! Could you give it a try? Should we add any kind of test?
I think this is more kind of a bug fix looking at the UX?
Comment #10
mstrelan commentedI tested with Ubuntu on both Firefox and Chromium with Demo Umami and the
/admin/contentview. Before (on main) only middle click worked as expected. After, middle click and Ctrl+click both opened in a new tab, and a regular click opened the dialog. I also tested with the keyboard, tabbing through the dropbutton to select Delete, pressing Enter opened the dialog whereas pressing Ctrl+Enter opened the new tab as expected.Would RTBC but I think someone better versed in frontend code should review it.
Comment #11
mstrelan commentedAs for test coverage, we have
Drupal\Tests\node\FunctionalJavascript\NodeDeleteConfirmTestthat confirms the dialog still works for a normal click. I investigated what it would take to try simulate ctrl+click and detect new tabs and have decided it's not worth it. I think we can live without it here.Comment #12
smustgrave commentedPersonally can't say I use these keys often but seems like a small enough change that doesn't negatively impact anyone and quality of life improvement for others who do.
Tested manually using the steps mentioned. Cnt + Click on views deleted opened the modal. With the MR opened in a new tab.
Changes seems small enough probably don't need dedicated test coverage and as mentioned clicking is still working as before.
Not 100% sure a bug or feature request but will leave that as is.
Comment #13
anybodyThanks for the valuable feedback @smustgrave! Happy to see this fixed soon. :)
Comment #14
benjifisherDoesn't a change like this need a change record?
Comment #15
quietone commented@benjifisher, thanks for noticing that. And the policy does state a change records should be added "When the change impacts the User Interface (UI), including CSS changes.} and is a "A change in the user experience".
Comment #16
mstrelan commentedI wouldn't have thought a bug fix needs one. The modal broke standard browser behaviour, this is restoring it.
Comment #17
anybody@benjifisher I agree with @mstrelan and the implementation does not change regular click behaviour, just allows regular use again, like before. Please make the final decision. Thanks!