Right now the offcanvas tray displaces the "main canvas" which under a certain width look weird.

Should we really use displace() and try to show the main canvas when the tray is open at widths < 400 px?

CommentFileSizeAuthor
#57 2793849-57.patch4.43 KBtedbow
#57 interdiff-52-57.txt1.2 KBtedbow
#52 interdiff-41-52.txt2.06 KBtedbow
#52 2793849-52.patch4.42 KBtedbow
#41 interdiff-37-40.txt968 bytestedbow
#41 2793849-40.patch4.38 KBtedbow
#37 2793849-37.patch4.13 KBtedbow
#35 2793849-35.patch4.19 KBtedbow
#28 interdiff-26-28.txt646 bytestedbow
#28 2793849-28.patch4.19 KBtedbow
#28 2793849-28-TEST_ONLY.patch1.98 KBtedbow
#26 interdiff-21-26.txt1.21 KBtedbow
#26 2793849-26.patch4.19 KBtedbow
#25 Screen Shot 2016-12-20 at 09.57.00.png224.54 KBalexpott
#25 Screen Shot 2016-12-20 at 09.56.34.png151.03 KBalexpott
#21 2793849-21-TEST_ONLY.patch1.98 KBtedbow
#21 interdiff-19-21.txt677 bytestedbow
#21 2793849-21.patch3.79 KBtedbow
#19 interdiff-17-19.txt3.75 KBtedbow
#19 2793849-19.patch3.79 KBtedbow
#17 screenshot2.jpg5.86 KBtedbow
#17 screenshot1.jpg8.39 KBtedbow
#17 2793849-17.patch4.12 KBtedbow
#17 interdiff-13-17.txt1.25 KBtedbow
#13 interdiff-10-13.txt2.1 KBtedbow
#13 2793849-13.patch3.92 KBtedbow
#10 interdiff-2793849-9-10.txt1.41 KBtedbow
#10 2793849-10.patch1.75 KBtedbow
#9 offcanvas.gif1.01 MBGrandmaGlassesRopeMan
#9 interdiff.txt1.12 KBGrandmaGlassesRopeMan
#9 2793849-8.patch1.71 KBGrandmaGlassesRopeMan
#6 interdiff-2793849-4-6.txt628 bytestedbow
#6 2793849-6.patch1.01 KBtedbow
#4 2793849-4.patch1.16 KBtedbow
offcanvas_mobile.png90.47 KBtedbow
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tedbow created an issue. See original summary.

nod_’s picture

Wouldn't be an issue if we were doing real offcanvas on any screen size.

nod_’s picture

Maybe to be more constructive, we may want to do a real offcanvas thing and shift all the content to the left/right, hiding the element we're configuring even on desktop because changes require a page reload to be seen. It's not like there is a live preview of what is changing.

tedbow’s picture

Status: Active » Needs review
FileSize
1.16 KB

@nod_ maybe it offcanvas was badly named. And we should address that but...
A big part of the approved UX designs were that you could see the entire screen when the tray was opened.
We added #2782885: No indication what page element is being configured with Outside In so you could see the active element.
On smaller widths this is just not possible. The admin toolbar menu also does where at smaller widths it doesn't tried to displace the body.

I think because the forms in offcanvas are going to be wider that the admin menu we should let it take over the entire screen at smaller widths.

Here is a first try at that. It has to explicitly set the width of the tray to 100% to get around dialog.css which does

@media all and (max-width: 48em) { /* 768px */
  .ui-dialog {
    width: 92% !important;
  }
}

Status: Needs review » Needs work

The last submitted patch, 4: 2793849-4.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
FileSize
1.01 KB
628 bytes

Whoops! Fixed the JavaScript error

tedbow’s picture

Putting under parent to organize separating offcanvas into core dialog system.

tedbow’s picture

Status: Needs review » Needs work

The patch work but it has the weird effect of when you open the tray and the tray doesn't have a vertical scroll(most of the time?) the page behind the dialog scrolls.

GrandmaGlassesRopeMan’s picture

When the tray is open, append a class to the body to prevent scrolling. This class will be empty if the body is above the 460px threshold.

off canvas narrow width scrolling animation

tedbow’s picture

Status: Needs work » Needs review
FileSize
1.75 KB
1.41 KB

@drpal nice fix. I just changed the class name from
js-stop-scrolling to js-tray-open.

Thought we should a more general name so we could use it for other css we would want when the tray is open.

GrandmaGlassesRopeMan’s picture

Issue summary: View changes
phenaproxima’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Reviewed, and I don't see any red flags leaping out at me. But it should probably have a test. I'm pretty sure Mink has support for resizing the browser window, so there's no real reason not to test this.

tedbow’s picture

Ok I gave a try at the test but it doesn't seem to work.

tedbow’s picture

Status: Needs work » Needs review

The last submitted patch, 9: 2793849-8.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 13: 2793849-13.patch, failed testing.

tedbow’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Needs work » Needs review
FileSize
1.25 KB
4.12 KB
8.39 KB
5.86 KB

Ok. It looks the resizing is actually working. isVisible doesn't seem to be working

I have left a couple debugging lines in this patch that makes screenshots(you will have to update path to use)

Here are the resulting screenshots
Narrow width without tray open

Narrow width with tray open

So maybe isVisible is the wrong thing to check here

Status: Needs review » Needs work

The last submitted patch, 17: 2793849-17.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
FileSize
3.79 KB
3.75 KB

Ok I re-wrote the test to check for the padding on the main-canvas-wrapper element instead or isVisible(). Basically the main-canvas-wrapper element should NOT have padding when at more narrow width.

I had to test for +-20px on the actual breakpoint because stark theme failed exactly on the break point. I wanted to test 2 themes like the rest of the tests in this module.

tim.plunkett’s picture

+++ b/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php
@@ -69,4 +69,38 @@ public function testOffCanvasLinks() {
+    $themes = ['stark', 'bartik']; //,

Trailing comment

Can you post a test-only patch in addition to the updated patch, to prove it fails?
The test looks good, but let's prove it does what it says.

tedbow’s picture

@tim.plunkett thanks for review.
fixed comment
Also here is a test only patch.
/me crosses fingers

Status: Needs review » Needs work

The last submitted patch, 21: 2793849-21-TEST_ONLY.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review

Upload patches in wrong order. TEST_ONLY patch failed which was expected.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests
There was 1 failure:

1) Drupal\Tests\outside_in\FunctionalJavascript\OffCanvasTest::testNarrowWidth
Body not padded on narrow page with tray open.
Failed asserting that true is false.

/var/www/html/core/tests/Drupal/KernelTests/AssertLegacyTrait.php:43
/var/www/html/core/modules/outside_in/tests/src/FunctionalJavascript/OffCanvasTest.php:102

That's awesome, yay for JS tests

alexpott’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
FileSize
151.03 KB
224.54 KB

This causes two new issues for me.

The content is totally squashed on the right if just above the width

if you start editing at really low width and then expand out the settings tray doesn't pad right

tedbow’s picture

Status: Needs work » Needs review
FileSize
4.19 KB
1.21 KB

@alexpott thanks for the review and screenshots!

The content is totally squashed on the right if just above the width

This was caused by the dialog.css

@media all and (max-width: 48em) { /* 768px */
  .ui-dialog {
    width: 92% !important;
  }
}

It forces all dialogs to 92% at lower widths.

I have changed our css to override 92% to 100% for our dialog at max-width: 48em. Really it doesn't make sense at a lower width. Sense our css is loaded later it will override dialog.css

if you start editing at really low width and then expand out the settings tray doesn't pad right

I realized that on 'dialogContentResize.outsidein' we also need to pad the body. Fixed

Status: Needs review » Needs work

The last submitted patch, 26: 2793849-26.patch, failed testing.

tedbow’s picture

In #26 I forgot to update the width used in the test. There also unrelated failures b/c 8.3.x was broken but hopefully that is fixed.

The last submitted patch, 28: 2793849-28-TEST_ONLY.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 28: 2793849-28.patch, failed testing.

tedbow’s picture

Status: Needs work » Reviewed & tested by the community

Random test failure,ArgumentPlaceholderUpdatePathTest, back to RTBC, rinse and repeat ;)

The last submitted patch, 28: 2793849-28-TEST_ONLY.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 28: 2793849-28.patch, failed testing.

tkoleary’s picture

Status: Needs work » Reviewed & tested by the community
tedbow’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
4.19 KB

Just a re-roll b/c #2784571: Outside-in Accessibility: Allow escape from edit mode with ESC key was just committed and it changed all event namespaces in offcanvas.js from ".outside_in" to ".offcanvas.js"

Status: Needs review » Needs work

The last submitted patch, 35: 2793849-35.patch, failed testing.

tedbow’s picture

Status: Needs work » Needs review
FileSize
4.13 KB

Re-roll was wrong. There were few commits to this module happening very quickly on Friday.

GrandmaGlassesRopeMan’s picture

Status: Needs review » Reviewed & tested by the community
Wim Leers’s picture

+++ b/core/modules/outside_in/js/offcanvas.js
@@ -11,6 +11,8 @@
+  var minDisplaceWidth = 768;

Let's document why we pick this number.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
tedbow’s picture

Status: Needs work » Needs review
FileSize
4.38 KB
968 bytes

Added to comments to document minDisplaceWidth and related css as per #39

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Credit.

Comments look good to me.

webchick’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +JavaScript, +CSS, +markup

Ok, confirmed via testing that this does what it says on the tin. Let's doooo eeeet! (Also, YAY for tests!)

Committed and pushed to 8.3.x and cherry-picked to 8.2.x.

Thanks!

  • webchick committed 268163c on 8.3.x
    Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett, phenaproxima,...
webchick’s picture

Version: 8.3.x-dev » 8.2.x-dev
Status: Fixed » Needs work

Oops. I spoke too soon! Doesn't cleanly cherry-pick. Need a patch for 8.2.x as well, since it seems like a legit bug fix for the stable release.

  • webchick committed c106095 on 8.2.x
    Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett, phenaproxima,...
webchick’s picture

Version: 8.2.x-dev » 8.3.x-dev
Status: Needs work » Fixed

Oops, I see. The modules were out of sync because #2784571: Outside-in Accessibility: Allow escape from edit mode with ESC key wasn't back-ported (thanks, @tedbow!). Did that, and now...

Cherry-picked to 8.2.x as well. Thanks! :D

xjm’s picture

Version: 8.3.x-dev » 8.2.x-dev
Status: Fixed » Needs work

The test introduced by this patch is failing in HEAD, so rolling back for now until it can be fixed.

E.g. https://www.drupal.org/pift-ci-job/575041

  • xjm committed f93219d on 8.2.x
    Revert "Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett,...
xjm’s picture

It also failed in #41 BTW. ;)

  • xjm committed 68e01df on 8.3.x
    Revert "Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett,...
tedbow’s picture

Status: Needs work » Needs review
FileSize
4.42 KB
2.06 KB

Ok, I see what happened. Even though from #37 to #41 there was only a comment change in the meantime #2815831: Move Off-canvas related CSS from drupal.outside_in library to drupal.off_canvas got committed and that css selector needed to select the "main-canvas" from an id to a class.

The test needed to updated. This patch does that.

xjm’s picture

+++ b/core/modules/outside_in/css/outside_in.module.css
@@ -22,3 +22,14 @@
+/* Force the tray to be 100% width at the same breakpoint the dialog system uses to expand dialog widths. */

+++ b/core/modules/outside_in/js/offcanvas.js
@@ -11,6 +11,10 @@
+  // The minimum width to use body displace needs to match the width at which the tray will be %100 width.

I think our comment line length standards still apply to CSS and JS; aren't these way too long? Edit: Not that this blocks commit for an experimental module since the standard doesn't seem to be tested at least for eslint, but simple to fix.

xjm’s picture

Status: Needs review » Needs work

The last submitted patch, 52: 2793849-52.patch, failed testing.

tedbow’s picture

Version: 8.2.x-dev » 8.3.x-dev

Since this was reverted it needs to go back to 8.3.x.

Test failed in #52 because #2815831: Move Off-canvas related CSS from drupal.outside_in library to drupal.off_canvas
was not backported to 8.2.x. I added comment on that issue.

tedbow’s picture

Status: Needs work » Needs review
FileSize
1.2 KB
4.43 KB

Here is patch the fixes the comment lengths. I somehow messed up my eslint settings :(

The last submitted patch, 52: 2793849-52.patch, failed testing.

tedbow’s picture

For any reviewers and committers, I think this is ready to be RTBC again for 8.3.x but can't be committed to 8.2.x until #2815831: Move Off-canvas related CSS from drupal.outside_in library to drupal.off_canvas is backported to 8.2.x

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

#52 and #57 interdiffs look sane.

tedbow’s picture

@Wim Leers thanks!

Ok for any committers out there. #2815831: Move Off-canvas related CSS from drupal.outside_in library to drupal.off_canvas should probably be committed to 8.2.x first. then this issue can be committed to 8.3.x and 8.2.x.
Right now this only applies to 8.3.x because #2815831 was not committed to 8.2.x.

tedbow’s picture

Great #2815831: Move Off-canvas related CSS from drupal.outside_in library to drupal.off_canvas was committed to 8.2.x also

So now outside_in should identical again for 8.2.x and 8.3.x. Can do git check just in case:
git diff 8.2.x..8.3.x core/modules/outside_in/

This should now be good to go for both branches.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Ok, take 2! :)

Committed and pushed to 8.3.x, cherry-picked to 8.2.x. YEAH!

  • webchick committed bf05c52 on 8.3.x
    Issue #2793849 by tedbow, drpal, alexpott, xjm, tim.plunkett, Wim Leers...

  • webchick committed bf93f84 on 8.2.x
    Issue #2793849 by tedbow, drpal, alexpott, xjm, tim.plunkett, Wim Leers...

  • webchick committed 268163c on 8.4.x
    Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett, phenaproxima,...
  • xjm committed 68e01df on 8.4.x
    Revert "Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett,...
  • webchick committed bf05c52 on 8.4.x
    Issue #2793849 by tedbow, drpal, alexpott, xjm, tim.plunkett, Wim Leers...

  • webchick committed 268163c on 8.4.x
    Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett, phenaproxima,...
  • xjm committed 68e01df on 8.4.x
    Revert "Issue #2793849 by tedbow, drpal, alexpott, tim.plunkett,...
  • webchick committed bf05c52 on 8.4.x
    Issue #2793849 by tedbow, drpal, alexpott, xjm, tim.plunkett, Wim Leers...

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! :)