Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Off-Canvas II #10003

Merged
merged 28 commits into from Jun 22, 2017
Merged

Nested Off-Canvas II #10003

merged 28 commits into from Jun 22, 2017

Conversation

SassNinja
Copy link
Contributor

@SassNinja SassNinja commented May 3, 2017

As discussed in the original PR (whose history got messed up) I've recommitted everything and opened this new PR.

For reference check the original post:
#9988

@brettsmason again, would be great to get your feedback on my code :)

Best regards
Kai

@SassNinja SassNinja mentioned this pull request May 3, 2017
@brettsmason brettsmason self-assigned this May 3, 2017
@brettsmason
Copy link
Contributor

@SassNinja thanks for putting together a clean PR!
Sorry I'm struggling for time at the moment, but I'll do my best to review this in the next few days.

@brettsmason brettsmason self-requested a review May 3, 2017 11:26
@brettsmason
Copy link
Contributor

@SassNinja sorry for the delay in looking over this! Thanks a lot for putting this together 😄

So firstly, from what I understand the aim of this PR is:

  • Allow targetting non sibling content when opening an off canvas (remove reliance on sibling selector)
  • Add mixin/class to allow off canvas content to revert the off canvas styling

First thing I noticed is the nested right off canvas demo has an issue with the content not showing in the off canvas until the opening animation has finished, and vanishing as soon as the closing animation starts.

One thing I'm not sure about is making the off-canvas-container required again. There are situations where I think they may not be needed, so would be nice to keep it as simple as we can - it was a concious decision on my part to try and remove that requirement with the rewrite.

From the old work I did here: http://brettmason.co.uk/offcanvas/content-option/foundation.offcanvas.js you will see I took a slight different approach. Get the position class from the off-canvas element and add a class to the target content so we can transform it (http://brettmason.co.uk/offcanvas/content-option/_off-canvas.scss).

I'll continue to look over it as I haven't looked at off canvas for a few months so am a bit rusty again 😄 Have a look at what I put together too and see if any of that code could be used to perhaps simplify the approach a bit.

Good job so far though 👍

@SassNinja
Copy link
Contributor Author

SassNinja commented May 14, 2017

@brettsmason thanks for your feedback so far!

You're right regarding the aims of my PR. Several times I have been facing the problem I need some parts of the page to be usual content for desktop and move into off-canvas for medium down (without duplicate content!).
So I've created the in-canvas class to undo the off-canvas behaviour for specific breakpoints and I've made the off-canvas more flexible by enabling a nesting of element in content.

The things you noticed:

  1. indeed, the nested overlay element was jumping on transition end what seems to be a CSS issue – I've fixed this now (by replacing transform:none with transform:translate(0,0) )
  2. I don't understand what you mean with off-canvas-container dependency since there's not such a class... Would you explain this more detailed?

Apart from that I've checked you're code.
Seems you've had similar thoughts, as e.g. adding a direction class to the content, based on the element and to offer more than the siblings selector.

But compared to your approach I've used the position class (not the transform property/matrix) and I haven't only limited the content part to the open method but initialized the content as this.$content in the setup. My intention was to fully integrate the content.
Besides I've added a third option to find the content so there are 3 possibilities to find it:

  1. by content id (if specified in options)
  2. by sibling (as done currently & due to backwards compatibility)
  3. by closest match (fallback)

When you test my latest code you'll probabely notice some more issues:

Issue 1
The nested off-canvas isn't fixed anymore but scrolls with the content what is probably caused by the nested structure. The only fix for this that comes in my mind is to either force a scroll to top when nesting or to read the viewport's height and set it to the element. But I'm not quite happy with such a workaround...
Do you have another way in mind to fix this issue?

Issue 2
After some cross browser testing I've spotted a strange issue in the Internet Explorer where the nested push off-canvas is not working due to a different behaviour of the transform:translateX(-250px) of the .off-canvas-content .position-left.off-canvas {}
You can see this when opening the visual test (nested.html) and clicking on the 'Nested Left Push' button in IE (Windows 7). To fix this I would have to change it into transform:translateX(0px) but only for the IE!
Any idea how to fix this without a dirty browser hack?

Apart from that I'm quite happy with my code as it doesn't seem to break existing code (backwards compatibility was important to me) and offers much more flexibility for 'hardcore off-canvas users' cause it lets you also move several elements into the same off-canvas side. Regarding your code I haven't spotted something important that I've missed or should take over (at most the naming). In case I'm missing anything, just let me know.

I'm looking forward to getting more feedback from you once you've done reviewing my code and once the derusting is finished ;)

@brettsmason
Copy link
Contributor

@SassNinja I've pulled that down and the bug I mentioned is now gone 👍

To answer your points:

  1. Unfortunately there is no solution for this other than a JS hack, which I'd rather avoid if at all possible.
    See: http://stackoverflow.com/questions/15194313/transform3d-not-working-with-position-fixed-children for details, but basically a fixed position element looses its fixed position within a transformed parent. The only way to get around this would be to change the off canvas to not use transforms but use positioning instead (eg `left: -250px) etc. However this doesn't give as good performance as transform (especially on mobile), hence why I chose to use this rather than the old positioning of pre 6.3 (there were lots of bugs to do with this).

  2. I've tried the visual test in IE10 and IE11 - the off canvas doesn't seem to show for me at all. The overlap example is fine, but the other 2 don't show up.

I'm not totally sure at this point that its going to be possible to get a cross browser compatible version that allows nesting flawlessly. Removing the siblings reliance is definitely a good idea though.

Version 6.4 should be released in June, so would be good to get this included in some form!

@SassNinja
Copy link
Contributor Author

SassNinja commented May 16, 2017

@brettsmason yeah, I worried about that. I agree regarding the benefits of transform: performance is definitely more important!

I've adjusted the JS now so a fixed position gets emulated for a nested off-canvas element (by setting height & top value based on the viewport's height and current scrollTop).
Would be great if you or @kball can take a look at that commit (37f6dfb) since I'm not sure if my resize listener is the best solution.
(I was thinking about the mutation feature but not sure if it's build for this purpose)

The fixed issue seems to be solved now in my eyes. I've also added a new inner box shadow for a (nested) push off-canvas element because the ::after solution doesn't work if the element's height is greater than the viewport's height (non-nested elements seem to have the same issue).
I haven't tested this cross-browser but if it's fine, it would be probably a good idea to use this inner shadow for all push elements, no matter if nested or not.

The only issue that remains is the IE issue. I haven't found a solution for this yet but I'm working on it.

June as release date sounds good to me 👍
I'll do my best to finish the nested feature in time since I'm needing it myself for every project. It would be really helpful for me to use the official foundation version via bower instead of locally adjusting the code.
Of course any help is appreciated!

The height should not only be reset if the element is open but every time so the value is correct on opening.
Since position fixed doesn't work for nested off-canvas elements, it has to be position absolute. Surprisingly (not) the IE doesn't show an opened off-canvas element unless absolute is explicitly set.
@SassNinja
Copy link
Contributor Author

I think I've got it!
Apparently the IE has a problem with position fixed on nested off-canvas elements. Since it doesn't work and gets emulated by JS anyway, I've explicitly set it now. Seems to work :)

p.s.
do I have to mention that I hate the fuc**** IE ?!

Due to the IE fix where position absolute gets explicitly set, in-canvas has to use !important to override this reliably.
@SassNinja
Copy link
Contributor Author

@brettsmason did you already manage to review my latest code?
Would be great to know if you can see any issues I've missed.

@brettsmason
Copy link
Contributor

@SassNinja Apologies been working on getting the new grid sorted out and forgot!
I'll make sure I look this evening and come back back with feedback 😄

@rafibomb rafibomb added this to the 6.4 milestone May 22, 2017
@rafibomb rafibomb self-requested a review May 22, 2017 16:42
& ~ .#{$content} {
margin-#{$position}: $offcanvas-size;
}
}

/// Overrides the off-canvas styles
@mixin in-canvas() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need for !important here? Generally we try and avoid the use of this whenever possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used !important here due to the CSS specificity of the things I'm overriding.
Otherwise every property I've set important wouldn't work with only one simple in-canvas selector.
I would have to fight against the specificity of the following selectors:

  • transform => .off-canvas-content .off-canvas.position-[DIRECTION]
  • visibility => .off-canvas.is-closed
  • height => inline style set by JS (fixed position emulation)
  • box-shadow => .off-canvas-content .position-[DIRECTION].is-transition-push
  • position => .off-canvas-content .off-canvas

I agree !important is not cool but I think in this case it's better than including in-canvas into all the long selectors (inline style is even impossible without important).
It's worth to mention I only used !important where necessary. Some properties of my in-canvas feature are working without it (background, width, overflow, transition) and just use 'inherit'.

@brettsmason
Copy link
Contributor

@SassNinja I've tested the updates you have made in a variety of browsers, including IE9. I'm pleased to report everything works great 👍

A few points/questions:

  • Use of !important - can this work without? We try and avoid this if at all possible
  • I've noticed off canvas is now set to visibility: hidden when closed - what was the reason for that?
  • Shadow - I was actually planning on removing this because of this issue: Off-canvas position top bug #9672 - do you think your changes would also of fixed this?

I'm going to invoke the power of @kball to take a look over the JavaScript as hes far better than me with that 😆

if (this.options.contentId) {
this.$content = $('#'+this.options.contentId);
} else if (this.$element.siblings('[data-off-canvas-content]').length) {
this.$content = this.$element.siblings('[data-off-canvas-content]');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a .first() as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ID doesn't make sense since there shouldn't be more than one match
  • siblings('[data-off-canvas-content]') didn't use first() in v6.3 so the behavior wouldn't change when upgrading (backwards compatibility)
  • closest('[data-off-canvas-content]') use first() but I think it should behave identical to siblings so either both use it or none

Since this.$content should only match one element I think it's a good idea to make this sure by using first(). I'll adjust this!

I can't imagine someone is expecting a match of two or more content elements here (as it was possible in v6.3) what doesn't make sense. So backwards compatibility shouldn't be problem here.

}

// Assume that the off-canvas element is nested if it isn't a sibling of the content
this.nested = this.$element.siblings('[data-off-canvas-content]').length && !this.options.contentId ? false : true;
Copy link
Contributor

@kball kball May 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused here... what is this trying to do? First off, since our outcomes are booleans I think this would be easier to read if we just invert the logic and get rid of the ternary operator, so:

this.nested = this.contentId || !this.$element.siblings('[data-off-canvas-content]');

That said, I don't understand why this is true... we're always nested if we have a contentId? What is the exact case we're trying to account for here?

Copy link
Contributor Author

@SassNinja SassNinja May 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using this.nested to emulate a fixed position via JS (see _emulateFixedPosition()) and force some options (e.g. no content scrolling) since this is necessary when nesting the off-canvas.

But it is quite difficult to determine if an off-canvas is nested – I don't want to parse the whole DOM for this!
That's why I assert the element is nested if it has no siblings content. But the usage of a contentId is a problem here since the related content element may be placed anywhere on the page (can be a sibling, can be nested, can be none of this).

Therefore I'm asserting that the off-canvas is nested if the contentId option is used so the code can probably simplified as it's probably not realistic to have multiple content elements at the same level:
this.nested = !this.$element.siblings('[data-off-canvas-content]').length;

Of course this limits the flexibility of using the contentId but I don't know a good way to check if the content element with the target Id is nested.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... well we've already found $content, so can we simply compare $content[0] to this.$element.siblings('[data-off-canvas-content]')[0] ?

@@ -65,9 +85,9 @@ class OffCanvas extends Plugin {
overlay.setAttribute('class', 'js-off-canvas-overlay ' + overlayPosition);
this.$overlay = $(overlay);
if(overlayPosition === 'is-overlay-fixed') {
$('body').append(this.$overlay);
$(this.$overlay).insertAfter(this.$element);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the beginning of this feature I had some issues with the z-index / overlapping of the overlay elements what was gone after this adjustment. I've just rechecked this and is doesn't occur anymore when I undo the adjustment so it's probably not necessary anymore.

Do you prefer the way it was done in v6.3 meaning to append it to the body?

I personally find it quite pleasant to have the overlay close to the related element but that may be a matter of taste.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern about having the overlay close rather than after the body is that unless I'm mistaken any sorts of transforms applied up the tree will break the fixed positioning

@kball
Copy link
Contributor

kball commented May 22, 2017

Left some feedback on the JS... agree on @brettsmason's questions as well, but broadly speaking this is looking very good. Nice work @SassNinja! let's get this across the finish line for 6.4 (first RC targeted for next Thursday)

@SassNinja
Copy link
Contributor Author

SassNinja commented May 23, 2017

@brettsmason @kball many thanks for your detailed feedback!

I've answered your questions in the appropriate review notes.
Regarding your messages:

@brettsmason

  • !important is necessary due to css specificity (see review note)
  • I've added visibility:hidden to support multiple off-canvas elements that share the same content element and the same position. You can see this in my visual test (nested.html) when you change the viewport to medium size and click on the two nested left buttons
  • yes, my shadow uses inset box-shadow instead of ::after which doesn't cause the scrolling issue. I still have to cross-browser test this and optimize the settings. But apart from that it's good to use imo and will probably fix Off-canvas position top bug #9672

@kball
It would be awesome if my feature is part of the RC! I'll do my best to finish the final adjustments in time.

Since it doesn't make sense to have more than one match for the content element I'm using first() to make this sure.
Top position mustn't get any inline height (preserve CSS height) but only an updated top value.
Bottom position is identical to top position but needs another calculation to pseudo fix it to bottom.
Using a pseudo ::after element for the off-canvas push panel shadow causes issues if the element's content height is greater than the element's height.
Therefore I've added two additional variables for the push panel and use it to create an inner box shadow.
Regarding the off-canvas docs setup, a detection of the prior off-canvas wrapper inner is necessary.
Besides I'm fixing some specificity issue caused by _page.scss (foundation-docs)
@SassNinja
Copy link
Contributor Author

@kball you're right, I didn't notice that new issue on the docs page – sorry for this! I'll do more testing when working on this feature.

Discarding the push transition if nested is not an option for me.
But I agree to you: it's probably to complex to finish it in time for all scenarios.

I've now worked over the whole code and (as suggested by you) forced the overlap transition if nested.
Please have a look at this limited version.

Apart from that I've noticed some issues that also occur on the live page:

  1. the docs are using the .off-canvas-wrapper-inner class that was used prior v6.3. But it seems the implementation is not correct: the content isn't nested in it (a sibling of the element) but a sibling of the wrapper inner. I've adjusted the JS to consider this but I think this is an issue, is it?
  2. several push off-canvas elements on the page (e.g. #offCanvasLeft) are supposed to use push transition but when you click the button, the overlap transition gets used. This is related to the issue above. I've fixed this in my fork but then the sticky top bar & side navi disappear on opening a push element and comes back on opening an overlap element. This is caused by the transform scope of the push transition. What do you think? Can this be ignored?
  3. I've noticed there is some CSS code in the _page.scss in a node module that is interfering with my code. Precisely there's a hardcoded off-canvas z-index 11 in node_modules/foundation-docs/scss/_page.scss. Is this necessary for some reason or would you mind deleting it?

@brettsmason @kball would be great if you can take a look at the issues I've listed above.
Hopefully this doesn't keep the limited version from being part of 6.4

@brettsmason
Copy link
Contributor

@SassNinja To answer your points:

  1. That is a mistake - that class was dropped in 6.3, and is no longer needed. No reference to it or anything should be needed in the JS/Sass as this shouldn't be there and should be removed from the docs. It only applies to versions before 6.3.

  2. Again I think this is a docs related issue, not off canvas itself. I checked the visual tests and it works correctly. We can file a seperate issue for the docs problems, so you dont need to make changes to cover this.

  3. Not sure on this will need to be checked.

I'll let @kball come back to you on the other stuff, but generally no need to worry about the docs, so anything you added to do with the inner wrapper etc because of the docs can be removed as its not needed 😄

Since wrapper inner is deprecated and erroneously implemented in the docs, I'm undoing my fix.
Once the docs got fixed, the push transition is going to work as expected.
Firstly the implementation was erroneous (content mustn't be a sibling of the wrapper but a child) and secondly the wrapper inner is deprecated.
Therefore I'm removing it what makes the push transitions on the off-canvas docs page working again as expected.
@SassNinja
Copy link
Contributor Author

  1. ok, I've undone my wrapper inner JS fix since it doesn't make sense then
  2. indeed this is not related to the off-canvas but to the erroneous implementation of the wrapper inner (content mustn't be a sibling of it but a child). I've fixed this too because I only had to remove two lines: 4a8132d
    Doesn't seem to be worth opening a new issue for this one, does it?

But as previously mentioned the fixed top bar on the docs page looses its fixed state now once a push transition element gets opened.
This is caused by transform: translate(0, 0) on the content container. You can see the behavior I'm talking about when you toggle between overlap & push elements (e.g. in the transitions chapter).

@brettsmason what do you think, shall I always set transform: none once the element is closed?

I mean the fixed state would still get lost (I remember our initial talk about fixed & transform) but at least it will be restored if closed.

Some words regarding no. 3 of my list:
You can also see the code in talk here https://github.com/zurb/foundation-docs/blob/master/scss/_page.scss
I'm talking about lines 38-40 that I suggest to remove. Currently I've fixed that by increasing the CSS specificity in my code but this feels wrong because the code in _page.scss doesn't make sense for me.

@mixin off-canvas-base(

  // Set the off-canvas z-index.
  z-index: $offcanvas-push-zindex;

  // Increase CSS specificity
  &.is-transition-push {
    z-index: $offcanvas-push-zindex;
  }

}

…ault transform none for content

Now the content container has none transform by default so position fixed works as soon as an push off-canvas is closed.
Besides the transitionend listener is now fixed so it isn't bound to only the content or the element but to both of them.
The content classes specification is now part of the setup (this.contentClasses) for an improved readability.
…orrectly

Due to the content's initial transform:none the transitionend listener didn't work for the content container.
This is fixed now by using the has-transition-push class that is also used in the positions mixin to limit the translate to push transitions.
Since the limited version doesn't enable push transitions for nested elements, there's no need to listen on the content because the element always gets moved.
@SassNinja
Copy link
Contributor Author

Update:

I've worked over the add/remove content classes part now and set transform:none to default as suggested in my previous post.
As a result the fixed state (e.g. the top bar in the docs) gets restored once the push element is closed.

So for me the limited version of this off-canvas feature looks good. Would be great if you can review it and let me know whether you spot any issues I've missed.

Apart from that I'm having some problems with the transitionend listener in another feature branch (not affecting this limited version – I'm justing working on a nested push transition support for the future):
If a push element is nested, the element's transform:translate property doesn't change but only the content's property.
Therefore I need an either-or translationend listener (either element or content). Unfortunately I haven't been able to achieve this yet. I tried to unbind the other listener if one gets triggered but both of them seems to get triggered simultaneously...
Any idea how to listen on both but only execute one of them?

Apart from that I'm facing an issue with the transitionend function which is imported from foundation.util.core.js:
As far as I understand it returns the supported event name for the current browser but I wondering

  1. why determining the right event over and over (every time one() gets called) instead of doing this only once?
  2. for me (Chrome, OSX) the function returns 'webkitTransitionEnd' but while this is working for most transitions it isn't working for a nested push element (I need 'transitionend' in this case). So any reason not to listen on all events (transitionend, webkitTransitionEnd, ...) instead of only one specific transition end event?

@kball maybe you can help me with this transitionend() function and tell me how this is supposed to be used or rather what's its purpose?

@kball
Copy link
Contributor

kball commented Jun 19, 2017

@SassNinja just checked this out, still seeing some of the docs examples not working, in particular the examples under Off-canvas Directions don't appear to work in this branch. It also seems to break the push examples in the sticky visual test...

Unfortunately with just over 1 week to final 6.4 release, I think this is looking very likely to slip out to 6.5

@SassNinja
Copy link
Contributor Author

@kball so the directions chapter is the only 'erroneous' part in the docs, isn't it?
I've increased the CSS specificity now so it behaves similar to the live version, meaning nesting a content container in another content container gets considered.

But to be honest I'm not sure if this behavior makes sense. I can't imagine why you would nest a content in another content. Besides it looks weird (in my fork & live) when the nested content and its elements doesn't act as the usual off-canvas (whitespace between both).

Regarding the off-canvas sticky visual test:
What exactly is the issue you spotted?

The sticky bar looses it's fixed state on opening a push element and gets it back once the element is closed. As mentioned in my previous posts this is caused by the transform scope the push transition creates.

It's a pity if at least my limited feature won't be part of 6.4 but I understand you want to be on the safe side.
If you give me faster feedback regarding issues & change request I'll do my best to fix & implement it asap.

@Renkas
Copy link
Contributor

Renkas commented Jun 20, 2017

I do hope this will find it's way to 6.4 at least in the minimal form. I could use the functionality as I have pretty similiar usecase as described in the initial post #9988
I can hold off the frontend development of our app's new design a little bit and/or work on other areas in the meantime but this functionality would be massive improvement.

@kball
Copy link
Contributor

kball commented Jun 20, 2017

@SassNinja you are correct, I apologize, I reconfirmed that sticky visual test on prior releases just now and the behavior is the same.

@brettsmason can you take one final look through this and lets see if we can get this merged?

@brettsmason
Copy link
Contributor

@SassNinja Really sorry I've been MIA - head stuck in the XY grid.

So pulled down the latest changes and have been looking over it for any bugs I can find:

  • The nested left push example (offCanvasNestedLeftPush) doesn't seem as smooth when opening/closing as the non-nested example. Any idea why that could be?
  • The close button stays visible when an off canvas is in-canvas. This should probably set to display: none the same as the reveal-for-x method
  • I'd still love to remove the !important usage some how... I need to spend a bit more time trying to understand the current Sass structure and see if we can improve it or not.

👍 though its looking good overall.

z-index: $offcanvas-push-zindex;

// Increase CSS specificity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this? Don't fully understand why its needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done this to override the fix z-index that is set in https://github.com/zurb/foundation-docs/blob/master/scss/_page.scss
If this gets removed we'll be able to undo this specificity fix.

@@ -154,10 +185,20 @@ $maincontent-class: 'off-canvas-content' !default;

transform: translateX(-$size);
overflow-y: auto;

// Sets the position for nested off-canvas element
@at-root .#{$maincontent-class} .off-canvas.position-#{$position} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the route cause for the need for !important usage. You have a better understanding of the way nested works though, but is there no way we could restructure the Sass a bit to make this less specific? I understand it may not be possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was facing a lot specificity problems when mixing push & overlap with the nested feature.
But since the push support for nested elements is removed (for now) I guess this may get simplified a bit.

Would you like me to work over it and see what I can cut down for this limited version?

Since the push support for nested elements got reverted the height doesn't have to fight inline CSS anymore. Box shadow and transform override work with a increased CSS specificity now.
Keyboard.releaseFocus(this.$element);
}

// Listen to transitionEnd and add class when done.
this.$element.one(Foundation.transitionend(this.$element), function(e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to change to using an import rather than Foundation global (see https://github.com/zurb/foundation-sites/blob/develop/js/foundation.util.motion.js#L4 for example)

but if you like I can do this at merge time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done now in 5aa588d

@kball
Copy link
Contributor

kball commented Jun 21, 2017

I think with those last changes this is probably good to go! @brettsmason what do you think?

I'm out of office today but should be able to merge & turn around the RC tomorrow morning.

@brettsmason
Copy link
Contributor

@kball If we can solve issue 2 above and hide the close button when an off canvas is in-canvas (like reveal-for-x then yep I think we can merge this. We can always refine the specificity later on down the line.

Since reveal-for-x uses now CSS for hiding the related JS for the inline style is removed.
@SassNinja
Copy link
Contributor Author

@brettsmason thanks for the feedback & review!

Regarding your bug list:

  • what browser & OS were you using? I can't reproduce this issue (Safari, FF, Chrome – all on Mac OSX). For me both, nested and not nested, look identical. From a technical point of view there shouldn't be a difference since there's no transform scope for overlap & nested elements anymore and both use the same transition.
  • I wasn't sure about the close button as it's part of the content. So I wanted to leave it up to the user to take care of the element's content. But you're right, a default display:none is better in this case as this is probably the most desired behavior. I've adjusted this now and replaced the inline display:none of reveal-for-x (prior via JS) with my CSS solution in one go. I hope this is ok? You can see it here 8c03358
  • I've got rid of all in-canvas !important now: height works without it since there's no nested push support anymore (= no inline CSS) and box shadow + transform have an increased CSS specificity now (by using the position classes)

@kball I've adjusted this as requested by you. It's part of this commit 5aa588d

@brettsmason
Copy link
Contributor

@SassNinja Thanks for taking another look!

To answer your points:

  • I think this was actually my laptop being weird as I haven't had the issue since so I would disregard this
  • Great that looks better, and good call about changing the reveal option to CSS too
  • Amazing! 😄 Much better

Great work and thanks for being so patient and thorough 👍

@kball from my point of view this looks ready to merge now. You might want to check the JS changes quickly but I'm happy with the Sass.

@kball
Copy link
Contributor

kball commented Jun 22, 2017

All right! Scanned the JS again and happy with it as well. Merging. Last major feature change to sneak into the 6.4 release :) Nice work @SassNinja!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants