Problem/Motivation

In the interest of removing jQuery UI, which were to be removed or replaced (#3067261: [Plan] Remove jQuery UI components used by Drupal core and replace with a set of supported solutions), Views UI's direct usage of the jquery.ui.dialog library needs to be changed so that the underlying library can be deprecated and ultimately removed.

Proposed resolution

Change Views UI's direct usage of jquery.ui.dialog to drupal.dialog.

Remaining tasks

  • Switch the library usage.
  • Resolve any regressions.

User interface changes

TBD, hopefully none.

API changes

TBD, hopefully none.

Data model changes

n/a

Release notes snippet

TBD.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna created an issue. See original summary.

DamienMcKenna’s picture

Status: Active » Postponed
DamienMcKenna’s picture

Status: Postponed » Needs review
FileSize
671 bytes

Ok, I found it.

DamienMcKenna’s picture

So, does the fact that there are no test failures mean that a) everything still works, or b) there aren't enough tests of the Views UI to trigger a failure?

catch’s picture

Issue tags: +Needs screenshots

We do have some js tests of Views UI but I don't know if it's enough. I think we need a before/after screenshot here to see how it all looks.

bnjmnm’s picture

Issue tags: -Needs screenshots
FileSize
385.3 KB
441.75 KB

Attached are screenshots of Views UI using jQueryUI dialog vs. drupal.dialog. The only difference I could find was a welcome one -- when jQueryUI dialog is used directly, the toolbar is still interactable when modals are open - this should not be the case. This is fixed by using drupal.dialog.

My manual testing included IE11, Firefox, Safari, confirming that the dialogs were not suddenly moveable or resizable via pointer, and verifying no changes in keyboard navigation or screenreader output.

bnjmnm’s picture

Status: Needs review » Reviewed & tested by the community

Based on my review in #6, this can get RTBC'd.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/views_ui/src/ViewEditForm.php
@@ -110,7 +110,7 @@ public function form(array $form, FormStateInterface $form_state) {
+    $form['#attached']['library'][] = 'core/drupal.dialog';

Based on Drupal\Core\Render\MainContent\ModalRenderer, we should add dependency to core/drupal.dialog.ajax here.

tedbow’s picture

Status: Needs work » Needs review
FileSize
673 bytes
676 bytes

Fixed #8

bnjmnm’s picture

Status: Needs review » Needs work
FileSize
1.03 MB

Looks like switching the library does introduce some unwanted artifacts. I discovered this while testing #9, but it also happens with #3. It does not happen on HEAD.

While scrolling with the modal open, a dark border intermittently appears between the button pane and content. If scrolling stops while this is visible, it will remain in the modal.

I believe this is a conflict between the JS added by drupal.dialog vs dialog.views.js. The functionality added by dialog.views.js is behavior that is triggered while scrolling, so it's not surprising that scrolling would be where a conflict was seen.

It sure seems like removing dialog.views.js from the views_ui.admin library would take care of this., since core's dialog handling *seems* to accomplish everything this does. It does add a .views-ui-dialog-scroll class that is targeted in css, which was added in this issue/comment: #1851414: Convert Views to use the abstracted dialog modal. If it turns out that dialog.views.js is unnecessary, it's quite possible this rule is also unnecessary:

.views-ui-dialog.views-ui-dialog-scroll .ui-dialog-titlebar {
  border: none;
}
lauriii’s picture

@bnjmnm I tried to reproduce the problem on Chrome, Firefox and Safari but all of them work as expected. Which browser and browser version did you use?

bnjmnm’s picture

Status: Needs work » Reviewed & tested by the community

Turns out the issue I found in #10 happens on HEAD as well. It only occurs on specific viewport heights and my tests with patches happened to be at those heights, while my tests on HEAD did not. Based on this being a pre-existing issue, this can go back to RTBC.

At reliable way to reproduce the issue:
- Use chrome
- Go to /admin/structure/views/view/content
- Open the Tab: Content dialog
- Gradually reduce the browser viewport height, and the dark line will appear at specific heights.

I also confirmed that removing dialog.views.js does fix this. That's out of scope for this issue, so I'm about to create a followup.

  • lauriii committed 4b32a6e on 9.0.x
    Issue #3113556 by tedbow, DamienMcKenna, bnjmnm, lauriii: Change Views...

  • lauriii committed 580a853 on 8.9.x
    Issue #3113556 by tedbow, DamienMcKenna, bnjmnm, lauriii: Change Views...
lauriii’s picture

Version: 8.9.x-dev » 8.8.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Tested this manually using the instructions in #12 and I could reproduce the problem, both before and after the patch.

Committed 4b32a6e and pushed to 9.0.x and 8.9.x. Thanks!

Given that this has some positive implications on the interaction with toolbar as described in #6, we might want to consider backporting this to 8.8.x too.

bnjmnm’s picture

xjm’s picture

Couldn't this potentially have some disruptive impacts for Views-extending contrib by changing what JS is loaded on the page? Maybe we're OK with that since it's an admin form.

Also, should this have come with a cache clear? (If so, that would be a reason not to backport it to 8.8.x since otherwise 8.8.4 would not require any cache clear.)

lauriii’s picture

Couldn't this potentially have some disruptive impacts for Views-extending contrib by changing what JS is loaded on the page?

I guess someone could be for example detaching the library using form alters, but that seems unlikely. This doesn't feel too risky for frontend related extensions because jQuery dialog is still being used under the hood. This means that any jQuery events they might be using are still triggered. What is also interesting, is that even before this change, the core/drupal.dialog.ajax library was inserted to the page with ajax, meaning that the libraries are only different at the state where dialog has not been inserted using ajax yet.

Also, should this have come with a cache clear?

I tested manually that this doesn't need a cache clear. It seemed like Views UI had disabled caching on the View edit form.

lauriii’s picture

Version: 8.8.x-dev » 8.9.x-dev
Status: Patch (to be ported) » Fixed

I think it's fine to leave this just to 8.9.x even though this could be eligible for 8.8.x. Committers are very busy at the moment and I don't want to add this to release manager's workload.

Status: Fixed » Closed (fixed)

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