Problem/Motivation

Settings Tray "Edit Mode" and QuickEdit module editing don't work well together as far as UX and it is not clear which links or form elements will function as regular links(leave the page) and which are disabled in edit mode.

Problems

  1. If you open QuickEdit toolbar and then open a form in the Tray then both will be open confusing the focus of the user.
  2. If you do the reverse open a form in the tray and then open QuickEdit toolbar they still will remain open confusing the focus of the user.
  3. Click anywhere on a block that works with Settings Tray will open the try to edit the block. On the other hand sections of the page that are controlled by QuickEdit you have open the contextual like and click "Quick Edit"
  4. Form elements and links on the page can still have link pointers(the little hand) suggesting they maybe should work
  5. Forms elements such as textfield on the page can gain focus if you click and quickly type.

Proposed resolution

Make a more unified experience between QuickEdit and Settings Tray edit modes.

  1. If QuickEdit form is open then the user triggers a block form to open in the Tray automatically close the QuickEdit form.
  2. If the tray is open with a block form and user triggers the quick edit form automatically close the tray.
  3. Disable the pointer for links and form element forms that are disabled by Settings Tray edit mode. This includes forms in the blocks and main content area(i.e. search block and search page)
  4. Don't allow form elements that are disabled by Settings Tray edit mode to gain focus

Remaining tasks

None

User interface changes

All described in "Proposed resolution" section above

API changes

None

Data model changes

None

Original summary

Follow-up to #2753941: [Experimental] Create Outside In module MVP to provide block configuration in Off-Canvas tray and expand site edit mode.

Links, buttons, etc, on the page behave inconsistently with Outside In. Some are overridden by the Edit toggle, and clicking on them opens the configuration sidebar for that element. Others submit forms or navigate away, taking you to other pages such that it is unclear whether you are still in Edit mode or not.

According to #2732443-35: Finalize the behavior for triggering view/edit/build modes from the toolbar (and fix the "disappearing toolbar") the toolbar is taken away to keep the user from accidentally navigating away from the page, but it seems much worse to me for some links to open the editing mode and others to take you away from the page. At least the Toolbar is clearly not part of the canvas you are editing.

Proposed resolution

Make links, buttons, etc. on the page being edited behave in a consistent fashion.

CommentFileSizeAuthor
#85 edit-4.gif436.53 KBGrandmaGlassesRopeMan
#85 edit-3.gif434.78 KBGrandmaGlassesRopeMan
#85 edit-2.gif641.18 KBGrandmaGlassesRopeMan
#85 edit-1.gif476.19 KBGrandmaGlassesRopeMan
#82 2782915-82.patch12.84 KBtedbow
#82 interdiff-75-82.txt6.18 KBtedbow
#76 2782915-76-check-random-fail.patch10.06 KBtedbow
#75 2782915-75.patch9.46 KBtedbow
#67 2782915-67.patch10.17 KBtedbow
#65 2782915-65.patch10.11 KBtedbow
#65 2782915-65-TESTS_ONLY.patch7.05 KBtedbow
#65 interdiff-2782915-58-65.txt682 bytestedbow
#58 interdiff-2782915-55-58.txt6.35 KBtedbow
#58 2782915-58.patch10.16 KBtedbow
#55 interdiff-2782915-52-55.txt1.63 KBtedbow
#55 2782915-55.patch9.23 KBtedbow
#52 2782915-51.patch9.46 KBdroplet
#50 2782915-50.patch6.5 KBnickgs
#48 2782915-48.patch8.64 KBdroplet
#47 interdiff.patch838 bytesdroplet
#47 2782915-46.patch39.72 KBdroplet
#40 interdiff-2782915-37-40.txt2.67 KBtedbow
#40 2782915-40.patch8.3 KBtedbow
#37 interdiff-37-37b.txt520 bytestedbow
#37 2782915-37b-no-pointer-css.patch5.5 KBtedbow
#37 2782915-37.patch6.01 KBtedbow
#35 interdiff-2782915-34-35.txt5.45 KBtedbow
#35 2782915-35.patch12.42 KBtedbow
#34 interdiff-2782915-32-34.txt1.3 KBtedbow
#34 2782915-34.patch9.26 KBtedbow
#32 2782915-31.patch8.34 KBtedbow
#27 interdiff-2782915-15-27.txt2.2 KBtedbow
#27 2782915-27.patch2.85 KBtedbow
#15 interdiff-2782915-14-15.txt582 bytestedbow
#15 2782915-15.patch3.57 KBtedbow
#14 interdiff-12-14.txt603 bytestedbow
#14 2782915-14.patch3.58 KBtedbow
#12 interdiff-2790855-7-12.txt1.29 KBtedbow
#12 2782915-12.patch3.59 KBtedbow
#10 2782915-9.patch3.35 KBtedbow
#8 2782915-8-links_changes_only--do-not-test.patch3.41 KBtedbow
#8 interdiff-2782915-7-8.txt1.44 KBtedbow
#8 2782915-8.patch36.06 KBtedbow
#7 2782915-links_only-do-not-test.patch2.84 KBtedbow
#7 2782915-7.patch35.5 KBtedbow
link_behavior_2.png36.83 KBxjm
link_behavior.png63.42 KBxjm

Comments

xjm created an issue. See original summary.

xjm’s picture

Issue summary: View changes
tkoleary’s picture

This is partially a result of the fact that even if links are disabled, their hover states are not. This leads to the mistaken impression that what you are clicking to open the off-canvas tray is the "Add content" link when in fact you are clicking the entire block.

We need to find a way to disable all hover states. Something like:


#main-canvas link:hover {
  pointer-events: none;
}

xjm’s picture

Thanks @tkoleary.

Note that the opposite is also true of form buttons, links in the main content area, etc. -- they are clickable and will take you away from your current configuration adventure. So maybe it is a combination of two fixes needed, one for link styling in configurable blocks, and one for links in non-configurable blocks. (And/or, some other fix for interacting with the main content area like #2783509: Outside In's "Edit" toggle lets you do just about everything except edit your content.) Edit: Make that three possibly, taking into account the issue with form elements in configurable blocks.

webchick’s picture

Issue tags: +Usability, +sprint
tedbow’s picture

Component: quickedit.module » outside_in.module
tedbow’s picture

Status: Active » Needs review
StatusFileSize
new35.5 KB
new2.84 KB

This patch contains #2786459: "Offcanvas" tray should be using the existing dialog system because it hasn't been committed yet.
Also uploading a do-not-test.patch with only changes for this issue.

This patch

  1. Disables all form elements on the page(inside #main-canvas) when going into Editing mode
  2. Re-enables all form elements on the page when leaving edit mode.
  3. Avoids disabling already disabled elements to avoid accidently enabling them.
  4. Makes sure all links inside #main-canvas are prevented from leaving the page.

For item 4 we weren't apply the outside_in logic to the main content block because it doesn't have contextual links to edit the block. This is still the case but now links in the main content area will not leave the page in edit mode.

tedbow’s picture

This adds functionality that @xjm suggested here #2783509-10: Outside In's "Edit" toggle lets you do just about everything except edit your content.

I still think the biggest quick win would be providing the Outside In interactive JS on the main content block (not the region), but making the onclick behavior trigger Quick Edit (same as its contextual link) instead of a sidebar. Could we try a rough implementation of that and see if it is viable?

Adding it to this issue because seems to relate more.

Basically it does this by:

  1. first checking if the link should be covered by the outside_in pattern.
  2. If not looking at it's parents to see if it is another contextual region.
  3. If it is then click the link provided by the quickedit module if available.

I also added the functionality to close the Quickedit module editor when you open the offcanvas tray.

This patch contains #2786459: "Offcanvas" tray should be using the existing dialog system because it hasn't been committed yet.
Also uploading a do-not-test.patch with only changes for this issue.

Important: I realize now that will need to separate better now in the .js files what is outside_in and what is offcanvas re: #2784443: Move off-canvas functionality from Settings tray module into drupal.dialog.ajax library so that other modules can use it
Nope I was wrong this functionality is in outside_in.js where it should be.

tkoleary’s picture

@tedbow

Looks good when I test it.

The only thing i notice is that the hover states are still there (see #3).

tedbow’s picture

StatusFileSize
new3.35 KB

@tkoleary thanks for taking a look.

Now that #2786459: "Offcanvas" tray should be using the existing dialog system has landed here is patch without those changes.

It is the same as #8 except with the no pointers css suggested in #3

This what I ended up adding

#main-canvas.js-outside-in-edit-mode a,
#main-canvas.js-outside-in-edit-mode input{
  pointer-events: none;
}
#main-canvas.js-outside-in-edit-mode .contextual-links a {
  pointer-events: inherit;
}

It still has works with contextual links.

cashwilliams’s picture

This patch also contains the fix for #2787135: Editing mode gets "stuck" after switching between configuration of different blocks, was the on purpose?

@@ -120,7 +158,7 @@
    */
   Drupal.behaviors.toggleActiveMode = {
     attach: function () {
-      $('.contextual-toolbar-tab.toolbar-tab button').on('click', function () {
+      $('.contextual-toolbar-tab.toolbar-tab button').once('outside_in').on('click', function () {
         setToggleActiveMode();
       });
tedbow’s picture

StatusFileSize
new3.59 KB
new1.29 KB

This patch also contains the fix for #2787135: Editing mode gets "stuck" after switching between configuration of different blocks, was the on purpose?

@cashwilliams thanks no that was a mistake. Fixed

I also realize I lost some changes from #8 related to " Quickedit module editor ". So doing interdiff from there.

GrandmaGlassesRopeMan’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/outside_in/js/outside_in.js
    @@ -75,6 +91,40 @@
    +        $el.attr('data-outside-in-disabled', true);
    

    In some instances we are setting a class js-* to signal that we've modified things with JavaScript. Here we are setting a data attribute.

  2. +++ b/core/modules/outside_in/js/outside_in.js
    @@ -75,6 +91,40 @@
    +    $('*').removeAttr('data-outside-in-disabled');
    

    Instead of selecting all the elements, refine the selector to just get the elements with the correct data attribute.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new3.58 KB
new603 bytes

@drpal thanks for review.

In some instances we are setting a class js-* to signal that we've modified things with JavaScript. Here we are setting a data attribute.

All those a class js-* also are used so that css can reflect the change. In this case we strictly just need to remember which elements we have disabled so we know which ones to re-enable. We don't want to enable ones that were disabled when the page loaded or by some other Javascript.

Instead of selecting all the elements, refine the selector to just get the elements with the correct data attribute.

@drpal good point. Figured I could just chain onto previous line so now it is.
$('*[data-outside-in-disabled="true"]').prop('disabled', false).removeAttr('data-outside-in-disabled');

tedbow’s picture

StatusFileSize
new3.57 KB
new582 bytes

Talked to @drpal and figured out we could change
$('*[data-outside-in-disabled="true"]').prop('disabled', false).removeAttr('data-outside-in-disabled');
to
$('[data-outside-in-disabled]').prop('disabled', false).removeAttr('data-outside-in-disabled');
to be more efficient.

Status: Needs review » Needs work

The last submitted patch, 15: 2782915-15.patch, failed testing.

GrandmaGlassesRopeMan’s picture

Status: Needs work » Reviewed & tested by the community

Just one small point that is not critical. This looks good otherwise.

+++ b/core/modules/outside_in/js/outside_in.js
@@ -75,6 +91,39 @@
+    $('[data-outside-in-disabled]').prop('disabled', false).removeAttr('data-outside-in-disabled');

Setting the attribute to false might be redundant if we are just going to remove the entire data attribute.

tedbow’s picture

Setting the attribute to false might be redundant if we are just going to remove the entire data attribute.

@drpal looking at the jquery docs for attr and prop jquery treats properties like disabled differently from attributes like data-*
From http://api.jquery.com/attr/

To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method.

You can actually see in the the DOM that disabled property is actually removed when you call prop('disabled', false).

We used disabled to actually disable the form elements. data-outside-in-disabled is just used to remember which ones were disabled by use(as oppose to already being disabled or by other js).

If we just did .removeAttr('data-outside-in-disabled'); the elements would still be disabled.

tkoleary’s picture

@tedbow

Just took a quick look at this an it looks like an unintended side effect of this patch is that the "place block" links are disabled when both place block and outside-in are installed and the user is in edit mode with place block active.

I *think* this might be because place block is not using the contextual class, which it should.

Perhaps this should be a bug on place block? Seems odd that we should need to make an exception for place block links.

tedbow’s picture

@tkoleary I created a follow up issue #2796135: Allow modules to designate certain links should not be disabled during Edit mode

I *think* this might be because place block is not using the contextual class, which it should.

I don't think they should be using the contextual class.

The follow up issue would let module designate certain links should not be disabled in edit mode.

tedbow’s picture

Issue tags: +JavaScript
xjm’s picture

Issue tags: +rc eligible

As a change to a new experimental module, this is rc eligible per https://www.drupal.org/core/d8-allowed-changes#rc.

tkoleary’s picture

@tedbow

The follow up issue would let module designate certain links should not be disabled in edit mode.

Perfect.

riddhi.addweb’s picture

Issue tags: +drupal core
tedbow’s picture

Issue tags: -drupal core

@Jigar.tanna there is no need to tag issues with "drupal core", I have seen you add this tag to a few issue today. Drupal.org issue are in projects. Since this one is in "Drupal core (3060)" that is what determines it deals with "drupal core".

You can read about tagging issues here: https://www.drupal.org/node/1023102

By that way would be interested in your help on Outside In issues if you have the time and desire.

droplet’s picture

how about this?

  document.getElementById('main-canvas').addEventListener('click', function (e) {
    e.preventDefault();
    e.stopPropagation();
    console.log('action!');
  }, true);

Less side effects than changing the elements' attributes. (Imagine that if a module's script monitoring the attributes.)

If the patch is the only workaround, considering dispatch an event to inform other modules we are going to do crazy actions. Please stay away!

By the way, patch doesn't meet ESLint

tedbow’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.85 KB
new2.2 KB

@droplet thanks for the review

If the patch is the only workaround, considering dispatch an event to inform other modules we are going to do crazy actions. Please stay away!

This issue is not workaround. It is just fixing some problems in the initial("experimental") commit of the module. The plan was always to disable ways to leave the page in "Editing" mode

But yes we should dispatch events. I created a follow up #2797873: Dispatch Javascript events on Editing clicks and other events

Less side effects than changing the elements' attributes. (Imagine that if a module's script monitoring the attributes.)

Good call! For some reason the disableForms and enableForms functions where previously need or they would take the user to another. But I checked and it seems other changes in this issue has fixed the problem. I removed both disableForms and enableForms now.

The code for preventing the clicks is little move more complicated than your example code in #26 but basic idea is the same.
The things that make it more complicated are:

  1. Any click inside an element that has a outside_in.module contextual link should invoke that link
  2. Contextual links and buttons should still work as normal
  3. If you click in an element that is not inside an outside in editable but is inside an element that has quickedit.module contextual links then the quickedit.module link should be invoked

By the way, patch doesn't meet ESLint

Sorry about that, turns out I did not have ESLint setup correctly for the project. I have it setup correctly now. I saw the errors but I think the ESLint problems where in code that I removed now.

droplet’s picture

The code for preventing the clicks is little move more complicated than your example code in #26 but basic idea is the same.

Yeah, I assumed you will copy the complicated code over there. There's a difference:

My example code is event capturing rather than event bubbling (in jQuery). We dropped old IEs in D8, it's safe to use it :)

We captured it at topmost layer (outside_in adding hover styling there `.outside-in-editable`) and don't let it go down to links & form's inputs...etc

that's fine if #27 is working also . :)

tedbow’s picture

My example code is event capturing rather than event bubbling (in jQuery).

@droplet thanks for clarification. I have mostly been doing php for the last 4 years so if I had known that difference here I forgot. I read a tutorial and this makes sense now.

@droplet, since this issue is to "Standardize the behavior of links " and this patch does that can we move this idea to #2785589-22: Fix js and jsdoc of outside-in module which is broader issue about JS fixing? I have already quoted your idea there.

tedbow’s picture

Status: Needs review » Reviewed & tested by the community

Changing this back to RTBC.

Follow ups have been created for 2 new comment since previous RTBC.

@tkoleary #19 #2796135: Allow modules to designate certain links should not be disabled during Edit mode

@droplet #26 moved this idea to #2785589-22: Fix js and jsdoc of outside-in module

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 27: 2782915-27.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new8.34 KB

This patch updates the changes now that #2785589: Fix js and jsdoc of outside-in module is committed. Functionally it should be the same. I also update OutsideInBlockFormTest to test clicking on links inside the blocks in Edit mode to make sure it opens the block form in the offcanvas tray.

I am getting this error again

1) Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest::testBlock
Zumba\GastonJS\Exception\BrowserError: There was an error inside the PhantomJS portion of GastonJS.
This is probably a bug, so please report it:
click

Which might be particular to my local setup so I am going to upload to retest.

I think we should update the tests in this issue or a follow up. The JS testing seems pretty buggy to me so I am not sure we will be able to get all this but if we could in Edit mode we should test:

  1. Clicking anywhere in on the main node view opens the Quick Edit toolbar and closes an open offcanvas tray
  2. Clicking on form elements in blocks open the block form in off
  3. Opening the offcanvas try closes the Quick Edit toolbar if open
  4. Exiting edit mode closes the offcanvas tray if open
  5. Exiting edit mode closes Quick Edit toolbar if open
  6. Reloading the page in Edit mode stays in Edit mode

Status: Needs review » Needs work

The last submitted patch, 32: 2782915-31.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new9.26 KB
new1.3 KB

Ok this patch fixes the GastonJS bug by using Javascript to trigger the click. I don't like this but don't see another to get around this GastonJS bug.

tedbow’s picture

StatusFileSize
new12.42 KB
new5.45 KB

Ok this patch adds all of the test coverage I suggested in #32.

I think getting this test coverage in is import because even though this an experimental module we can be more confident going forward that aren't breaking existing functionality.

tedbow’s picture

Status: Needs review » Postponed
Issue tags: -Outside-in +[PP-1]Outside-in

Postponing b/c #2785589: Fix js and jsdoc of outside-in module got reverted.
That issue should go in first

tedbow’s picture

Status: Postponed » Needs review
StatusFileSize
new6.01 KB
new5.5 KB
new520 bytes

ok so #2785589: Fix js and jsdoc of outside-in module landed. Yay! thanks for everyone who worked on that!

2782915-37.patch is a reroll or #35 there were some big changes so couldn't do an interdiff.

I am getting some real strange local test errors so I am uploading 2 versions.

2782915-37.patch - is a re-roll with everything that was needed. It fails for me locally with

1) Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest::testBlocks
Zumba\GastonJS\Exception\BrowserError: There was an error inside the PhantomJS portion of GastonJS.
This is probably a bug, so please report it:
click
html.touchevents.details.js body.layout-one-sidebar.layout-sidebar-first.user-logged-in.path-user.toolbar-fixed.toolbar-horizontal div#main-canvas-wrapper div#main-canvas.js-outside-in-edit-mode div#page-wrapper div#page div#main-wrapper.layout-main-wrapper.layout-container.clearfix div#main.layout-main.clearfix div#sidebar-first.column.sidebar aside.section div.region.region-sidebar-first div#block-powered.contextual-region.outside-in-editable.block.block-system.block-system-powered-by-block div.content

/var/www/d8_2_ux/vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php:122
/var/www/d8_2_ux/vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php:99
/var/www/d8_2_ux/vendor/jcalderonzumba/gastonjs/src/Browser/BrowserMouseEventTrait.php:17
/var/www/d8_2_ux/vendor/jcalderonzumba/mink-phantomjs-driver/src/MouseTrait.php:31
/var/www/d8_2_ux/core/tests/Drupal/Tests/BrowserTestBase.php:1527
/var/www/d8_2_ux/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php:222
/var/www/d8_2_ux/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php:116

2782915-37b-no-pointer-css.patch is the same re-roll except with the changes to outside_in.module.css that were just to pointer-events:.
This patch passes locally for me.

I have no idea why but maybe it is a bug in GastonJS like error suggests. Or maybe they will both pass or neither ;)

I also uploaded an interdiff between the 2 patches.

The last submitted patch, 37: 2782915-37.patch, failed testing.

droplet’s picture

Umm. PointerEvents changed the click target that PhantomJS didn't expect I think. And no idea how well the PointerEvents working inside PhantomJS

My little thoughts:
A: It's known issues on testbots. We muted the PointerEvents.
B: Before use .triggerClick in above patches, I'd try jquery-simulate first. It sends a MouseEvents which same to gastonjs's API (non-behat-mink standard API):

  public function clickCoordinates($coordX, $coordY) {
    return $this->command('click_coordinates', $coordX, $coordY);
  }

But we can't get the X & Y from our test cases.

tedbow’s picture

StatusFileSize
new8.3 KB
new2.67 KB

@droplet this I think this is simpler solution I created a new test module, outside_in_test_css, which just adds this CSS to the all pages:

#main-canvas.js-outside-in-edit-mode a,
#main-canvas.js-outside-in-edit-mode input{
    pointer-events: inherit !important;
}

It just overrides the CSS pointer-events from the module. We aren't testing the pointer-events CSS which is simply visual effect. This fix lets us just us the standard click method for testing.

nickgs’s picture

Status: Needs review » Needs work

I saw @tedbow's tweet and felt compelled to give this a crack. I tried running the tests in two different environments and keep getting the following:

There was 1 failure:

1) Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest::testQuickEditLinks
Javascript condition met:
(jQuery('#quickedit-entity-toolbar').length > 0)
Failed asserting that false is true.

This is failing on the line 166 of OutsideInBlockFormTest.php:

      $this->waitForElement($quick_edit_selector);

This is happening right after we are clicking the body selector. It feels like this may have to do with what you guys are referring to above but I am not yet super familiar with these types of tests to offer a solution.

Other then that the functionality seems to be working.

droplet’s picture

default timeout time is too short, that's a cause may be.

nickgs’s picture

I think you may be right.

Although, I have been playing with different timeout values. I went up to 10 seconds and still not getting reliable passes. Its very sporadic.

This is what I am doing:

$this->waitForElement($quick_edit_selector, 10000);

Is this passing no problem for you guys?

tedbow’s picture

Status: Needs work » Needs review

@nickgs thanks for testing. It is working for me. I am retesting #40 just to be sure it works on DrupalCI consistently.

I don't think we should raise the default timeout in unless we find it is consistently not working. Because it gets called so many times this would really increase test time.

@nickgs also 1 thing that use to give me random result was the way I was invoking phantomjs. Are you running from command line? How are you invoking phantomjs?

Mine is
phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768

If you are getting errors with 10 second delay I feel it is something else.

changing to "Needs Review" until we make sure it is not a local testing issue.

droplet’s picture

@nickgs,

Capture the screenshot before & after that click

And try to remove the foreach loop

Status: Needs review » Needs work

The last submitted patch, 40: 2782915-40.patch, failed testing.

droplet’s picture

Status: Needs work » Needs review
StatusFileSize
new39.72 KB
new838 bytes
droplet’s picture

StatusFileSize
new8.64 KB
droplet’s picture

It's a true headache. #48 shown another random error but I didn't touch that line

nickgs’s picture

StatusFileSize
new6.5 KB

Thanks guys,

@tedbow That is exactly how I am invoking PhantomJS.

@droplet Good call on taking some screen shots and removing the foreach. Playing with this a bit I can confirm that the second node load is causing the failure. Being that we are not in edit mode on second load that seems to be why the assertion is not passing. Using the screen shots I can clearly see this.

I very well may be missing something but shouldn't we test that the quick edit links do NOT show when we click the $body_selector and are NOT in edit mode? If so the conditional would look something like this:

      if($page_load_times == 1) {
        // In Edit mode clicking selector should open QuickEdit toolbar.
        $this->waitForElement($quick_edit_selector);
      }
      else {
        // When not in Edit mode QuickEdit should not be open.
        $web_assert->elementNotExists('css', $quick_edit_selector);
      }

I am going to give a patch a shot here. Attached is a patch implementing this.

droplet’s picture

Being that we are not in edit mode on second load

I could confirm it too.

In bad case, a simple sleep(2) would save us to write huge amount of test code.

droplet’s picture

StatusFileSize
new9.46 KB

another dirty patch for the bots.

The last submitted patch, 50: 2782915-50.patch, failed testing.

droplet’s picture

+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
@@ -119,16 +124,94 @@ public function testBlocks() {
+      // Waiting for Toolbar animation.
+      $this->getSession()->wait(10000, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))');
...
+    // Waiting for QuickEdit icon animation.
+    $this->getSession()->wait(10000, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))');
...
+    // Waiting for Toolbar animation.
+    $this->getSession()->wait(10000, '(typeof(jQuery)=="undefined" || (0 === jQuery.active && 0 === jQuery(\':animated\').length))');

It seems working now. I will tidy up it later or anyone can help me? Thanks.

tedbow’s picture

StatusFileSize
new9.23 KB
new1.63 KB

This is cleaning up @droplet's patch. Basically swapping in \Drupal\FunctionalJavascriptTests\JSWebAssert::assertWaitOnAjaxRequest for the code he highlighted in #54 which is actually the same.

Everything else looks good. @nickgs and @droplet thanks for figuring this out!

droplet’s picture

Thank @tedbow. All Looks good now. I leave it as Needs review for one more eyes

tim.plunkett’s picture

The tests and JS look right, but I really am not okay with signing off on the JS.

Here are some nits instead!

  1. +++ b/core/modules/outside_in/css/outside_in.module.css
    @@ -47,3 +47,12 @@
    +#main-canvas.js-outside-in-edit-mode input{
    
    +++ b/core/modules/outside_in/tests/modules/outside_in_test_css/css/css_fix.theme.css
    @@ -0,0 +1,4 @@
    +#main-canvas.js-outside-in-edit-mode input{
    

    Needs space before {

  2. +++ b/core/modules/outside_in/js/outside_in.js
    @@ -85,6 +86,20 @@
    +   * Disable the QuickEdit module editor if open.
    ...
    +   * Close/remove offcanvas.
    

    Disables, Closes/removes

  3. +++ b/core/modules/outside_in/tests/modules/outside_in_test_css/css/css_fix.theme.css
    @@ -0,0 +1,4 @@
    +    pointer-events: inherit !important;
    

    Indented too far

  4. +++ b/core/modules/outside_in/tests/modules/outside_in_test_css/outside_in_test_css.libraries.yml
    @@ -0,0 +1,7 @@
    +
    +
    

    Extra lines

  5. +++ b/core/modules/outside_in/tests/modules/outside_in_test_css/outside_in_test_css.module
    @@ -0,0 +1,9 @@
    +<?php
    +
    +/**
    + * Implements hook_page_attachments().
    + */
    +function outside_in_test_css_page_attachments(array &$attachments) {
    

    These are still supposed to have @file

  6. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -119,16 +124,93 @@ public function testBlocks() {
    +   * Test QuickEdit links behavior.
    

    Tests

  7. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -119,16 +124,93 @@ public function testBlocks() {
    +    $node = $this->createNode(
    +      [
    ...
    +        'body' => [
    +          [
    

    That's a lot of blank lines, I'd tighten that up

  8. +++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OutsideInBlockFormTest.php
    @@ -119,16 +124,93 @@ public function testBlocks() {
    +      // TODO: Remove the hack after https://www.drupal.org/node/2542050.
    

    @todo Remove...

    (no colon or caps)

tedbow’s picture

StatusFileSize
new10.16 KB
new6.35 KB

@tim.plunkett thanks for review.

This addresses all the nits in #57

GrandmaGlassesRopeMan’s picture

Status: Needs review » Reviewed & tested by the community

On the JS side, this looks good to me.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 58: 2782915-58.patch, failed testing.

The last submitted patch, 58: 2782915-58.patch, failed testing.

tedbow’s picture

Status: Needs work » Reviewed & tested by the community

Failed b/c of unrelated test.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 58: 2782915-58.patch, failed testing.

nod_’s picture

Still need works:

+  function disableQuickEdit() {
+    $('.quickedit-toolbar button.action-cancel').click();
+  }
+
+  /**
+   * Closes/removes offcanvas.
+   */
+  function closeOffCanvas() {
+    $('.ui-dialog-offcanvas .ui-dialog-titlebar-close').trigger('click');
+  }

always use trigger() on jQuery objects, never the alias.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new682 bytes
new7.05 KB
new10.11 KB

@nod_ thanks for review. Here is a fix. also TESTS_ONLY patch.

The last submitted patch, 65: 2782915-65-TESTS_ONLY.patch, failed testing.

tedbow’s picture

StatusFileSize
new10.17 KB

just re-roll

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Changes look fine. Pre-RTBC assuming tests pass.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 67: 2782915-67.patch, failed testing.

tedbow’s picture

23:19:25 Slave went offline during the build
23:19:25 ERROR: Connection was broken: java.io.EOFException

Strange error saw the same on another issue.

Retesting

tedbow’s picture

Status: Needs work » Reviewed & tested by the community

Looks like #69 was cause by a testing infrastructure failure. Setting back to RTBC tests have continue to pass after that.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 67: 2782915-67.patch, failed testing.

The last submitted patch, 67: 2782915-67.patch, failed testing.

The last submitted patch, 67: 2782915-67.patch, failed testing.

tedbow’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Needs work » Needs review
StatusFileSize
new9.46 KB

Re-roll and changing to 8.3.x

Because this new test method testQuickEditLinks might have the same random fail potential as #2830485: \Drupal\Tests\outside_in\FunctionalJavascript\OutsideInBlockFormTest fails randomly

I will also in another comment attach a patch that simply runs this test 50x.

tedbow’s picture

Here is patch to check random file by running this test 50 times.

tedbow’s picture

Issue summary: View changes

Updating the summary to describe what this issue fixes.

Many of the original problems were fixed during #2785589: Fix js and jsdoc of outside-in module so they should not be included here.

tedbow’s picture

Status: Needs review » Reviewed & tested by the community

Ok setting back to RTBC since this was just a re-roll.

Current patch is #75. #76 was just to check ran 50 times there would be random file. No fail.

jojototh’s picture

Issue summary: View changes
alexpott’s picture

Status: Reviewed & tested by the community » Needs review

Manual testing in chrome. Things are working as I would expect after reading the issue summary. See screencast http://recordit.co/ADBnxIflsh

tedbow’s picture

Status: Needs review » Needs work

@alexpott thanks for looking at this issue and providing the screencast.

Yes I can confirm this problem. This seems to happen when you use the contextual links instead of just clicking the sections of the site in Edit mode.
Right now it is difficult to test contextual links. There are no tests for contextual links in core. Trying to solve that here #2821724: Create Javascript Tests for Contextual Links. this issue also provides a trait to make it easier to test.

tedbow’s picture

Status: Needs work » Needs review
StatusFileSize
new6.18 KB
new12.84 KB

Ok this patch fixes the problems @alexpott documented in #80 and adds testing for it.
I added the functions from #2821724: Create Javascript Tests for Contextual Links with @todo's to remove them when the trait is added in that issue.

The problem was that when the "Quick Edit" links from Settings Tray and QuickEdit module were clicked the new behavior was not triggered. This fixes that.

Status: Needs review » Needs work

The last submitted patch, 82: 2782915-82.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review

Ok the test failure is just same 1 8.3.x branch is having randomly.

So setting to "Needs Review" to get eyes on it.

GrandmaGlassesRopeMan’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new476.19 KB
new641.18 KB
new434.78 KB
new436.53 KB

This looks to be behaving correctly.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 82: 2782915-82.patch, failed testing.

tedbow’s picture

Status: Needs work » Reviewed & tested by the community

Ok the random test failure is just same 1 8.3.x branch is having randomly.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

All right! Tested this back a couple of weeks ago when the random testbot failures were screwing up the RTBC queue. Looks like alexpott also tested and his feedback was addressed, and nod_'s JS review was taken into account. No further bloickers.

Committed 5dbf5ab and pushed to 8.3.x. Thanks!

  • webchick committed 07d2ae1 on 8.3.x
    Issue #2782915 by tedbow, droplet, nickgs, drpal, xjm, tkoleary,...

  • webchick committed 935bd28 on 8.2.x
    Issue #2782915 by tedbow, droplet, nickgs, drpal, xjm, tkoleary,...
webchick’s picture

AHEM. It super helps when you remember to push. :P

Committed 07d2ae1 and pushed to 8.3.x, then cherry-picked to 8.2.x. Thanks!

  • webchick committed 07d2ae1 on 8.4.x
    Issue #2782915 by tedbow, droplet, nickgs, drpal, xjm, tkoleary,...

  • webchick committed 07d2ae1 on 8.4.x
    Issue #2782915 by tedbow, droplet, nickgs, drpal, xjm, tkoleary,...

Status: Fixed » Closed (fixed)

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

tedbow’s picture

Component: outside_in.module » settings_tray.module

Changing to new settings_tray.module component. @drpal thanks for script help! :)

avpaderno’s picture

Issue tags: -[PP-1]Outside-in