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
- If you open QuickEdit toolbar and then open a form in the Tray then both will be open confusing the focus of the user.
- 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.
- 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"
- Form elements and links on the page can still have link pointers(the little hand) suggesting they maybe should work
- 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.
- If QuickEdit form is open then the user triggers a block form to open in the Tray automatically close the QuickEdit form.
- If the tray is open with a block form and user triggers the quick edit form automatically close the tray.
- 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)
- 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
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.


| Comment | File | Size | Author |
|---|---|---|---|
| #85 | edit-4.gif | 436.53 KB | GrandmaGlassesRopeMan |
| #85 | edit-3.gif | 434.78 KB | GrandmaGlassesRopeMan |
| #85 | edit-2.gif | 641.18 KB | GrandmaGlassesRopeMan |
| #85 | edit-1.gif | 476.19 KB | GrandmaGlassesRopeMan |
| #82 | 2782915-82.patch | 12.84 KB | tedbow |
Comments
Comment #2
xjmComment #3
tkoleary commentedThis 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:
Comment #4
xjmThanks @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.
Comment #5
webchickComment #6
tedbowComment #7
tedbowThis 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
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.
Comment #8
tedbowThis adds functionality that @xjm suggested here #2783509-10: Outside In's "Edit" toggle lets you do just about everything except edit your content.
Adding it to this issue because seems to relate more.
Basically it does this by:
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 itNope I was wrong this functionality is in outside_in.js where it should be.
Comment #9
tkoleary commented@tedbow
Looks good when I test it.
The only thing i notice is that the hover states are still there (see #3).
Comment #10
tedbow@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
It still has works with contextual links.
Comment #11
cashwilliams commentedThis patch also contains the fix for #2787135: Editing mode gets "stuck" after switching between configuration of different blocks, was the on purpose?
Comment #12
tedbow@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.
Comment #13
GrandmaGlassesRopeManIn some instances we are setting a class
js-*to signal that we've modified things with JavaScript. Here we are setting a data attribute.Instead of selecting all the elements, refine the selector to just get the elements with the correct data attribute.
Comment #14
tedbow@drpal thanks for review.
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.
@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');Comment #15
tedbowTalked 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.
Comment #17
GrandmaGlassesRopeManJust one small point that is not critical. This looks good otherwise.
Setting the attribute to false might be redundant if we are just going to remove the entire data attribute.
Comment #18
tedbow@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/
You can actually see in the the DOM that
disabledproperty is actually removed when you callprop('disabled', false).We used
disabledto actually disable the form elements.data-outside-in-disabledis 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.Comment #19
tkoleary commented@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.
Comment #20
tedbow@tkoleary I created a follow up issue #2796135: Allow modules to designate certain links should not be disabled during Edit mode
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.
Comment #21
tedbowComment #22
xjmAs a change to a new experimental module, this is rc eligible per https://www.drupal.org/core/d8-allowed-changes#rc.
Comment #23
tkoleary commented@tedbow
Perfect.
Comment #24
riddhi.addweb commentedComment #25
tedbow@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.
Comment #26
droplet commentedhow about this?
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
Comment #27
tedbow@droplet thanks for the review
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
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:
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.
Comment #28
droplet commentedYeah, 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 . :)
Comment #29
tedbow@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.
Comment #30
tedbowChanging 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
Comment #32
tedbowThis 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
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:
Comment #34
tedbowOk 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.
Comment #35
tedbowOk 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.
Comment #36
tedbowPostponing b/c #2785589: Fix js and jsdoc of outside-in module got reverted.
That issue should go in first
Comment #37
tedbowok 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
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.
Comment #39
droplet commentedUmm. 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):
But we can't get the X & Y from our test cases.
Comment #40
tedbow@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:
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.
Comment #41
nickgs commentedI 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:
This is failing on the line 166 of OutsideInBlockFormTest.php:
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.
Comment #42
droplet commenteddefault timeout time is too short, that's a cause may be.
Comment #43
nickgs commentedI 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:
Is this passing no problem for you guys?
Comment #44
tedbow@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 768If 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.
Comment #45
droplet commented@nickgs,
Capture the screenshot before & after that click
And try to remove the foreach loop
Comment #47
droplet commentedComment #48
droplet commentedComment #49
droplet commentedIt's a true headache. #48 shown another random error but I didn't touch that line
Comment #50
nickgs commentedThanks 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:
I am going to give a patch a shot here. Attached is a patch implementing this.
Comment #51
droplet commentedI could confirm it too.
In bad case, a simple
sleep(2)would save us to write huge amount of test code.Comment #52
droplet commentedanother dirty patch for the bots.
Comment #54
droplet commentedIt seems working now. I will tidy up it later or anyone can help me? Thanks.
Comment #55
tedbowThis 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!
Comment #56
droplet commentedThank @tedbow. All Looks good now. I leave it as Needs review for one more eyes
Comment #57
tim.plunkettThe tests and JS look right, but I really am not okay with signing off on the JS.
Here are some nits instead!
Needs space before {
Disables, Closes/removes
Indented too far
Extra lines
These are still supposed to have @file
Tests
That's a lot of blank lines, I'd tighten that up
@todo Remove...(no colon or caps)
Comment #58
tedbow@tim.plunkett thanks for review.
This addresses all the nits in #57
Comment #59
GrandmaGlassesRopeManOn the JS side, this looks good to me.
Comment #62
tedbowFailed b/c of unrelated test.
Comment #64
nod_Still need works:
always use trigger() on jQuery objects, never the alias.
Comment #65
tedbow@nod_ thanks for review. Here is a fix. also TESTS_ONLY patch.
Comment #67
tedbowjust re-roll
Comment #68
phenaproximaChanges look fine. Pre-RTBC assuming tests pass.
Comment #70
tedbowStrange error saw the same on another issue.
Retesting
Comment #71
tedbowLooks like #69 was cause by a testing infrastructure failure. Setting back to RTBC tests have continue to pass after that.
Comment #75
tedbowRe-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.
Comment #76
tedbowHere is patch to check random file by running this test 50 times.
Comment #77
tedbowUpdating 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.
Comment #78
tedbowOk 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.
Comment #79
jojototh commentedComment #80
alexpottManual testing in chrome. Things are working as I would expect after reading the issue summary. See screencast http://recordit.co/ADBnxIflsh
Comment #81
tedbow@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.
Comment #82
tedbowOk 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.
Comment #84
tedbowOk the test failure is just same 1 8.3.x branch is having randomly.
So setting to "Needs Review" to get eyes on it.
Comment #85
GrandmaGlassesRopeManThis looks to be behaving correctly.
Comment #87
tedbowOk the random test failure is just same 1 8.3.x branch is having randomly.
Comment #88
webchickAll 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!
Comment #91
webchickAHEM. 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!
Comment #95
tedbowChanging to new settings_tray.module component. @drpal thanks for script help! :)
Comment #96
avpaderno