Trying to measure the elements height instead of width to determine responsive changes for Seven's navigation tabs.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because jquery.intrinsic.js relies on an undocumented jQuery functionality that will is removed in jQuery 3.
Issue priority Not critical because frontend performance
Prioritized changes The main goal of this issue is usability/performance. handleResize took 10ms on chrome before, 5ms after.

No visual change:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

droplet’s picture

Status: Active » Needs review
nod_’s picture

Status: Needs review » Needs work

Ohh that's brilliant. And way less expensive on the DOM side. Can you remove the jquery.intrinsic.js file as well?

It's a really nice solution. The way it works is to look at the height of a single tab (like the "manage form display" tab) and compare it with the height of the element containing tabs. If the container is taller than a single tab height, it means tabs are starting to wrap on a new line and we should display it inline.

I'm closing the $.swap issue for this one.

LewisNyman’s picture

That's clever!

droplet’s picture

Status: Needs work » Needs review
FileSize
3.51 KB

Thanks.

- Removed jquery.intrinsic.js

nod_’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Working :D

No more occurence of intrinsic in the code (wasn't in the changelog either).

nod_’s picture

Status: Reviewed & tested by the community » Needs work

Have to put this back to NW, there is a missing dependency on core/drupal.debounce for the nav-tabs lib (if you disable the toolbar, the script crashes without de dependency).

On the performance side, before the patch: handleResize took 10ms on chrome, after 5ms. Very nice.

nod_’s picture

Status: Needs work » Needs review
FileSize
4.29 KB
372 bytes

Added dep on debounce.

droplet’s picture

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

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs beta evaluation, +Needs manual testing

Great news about the performance improvement! Let's add a beta evaluation that mentions that.

We should also have manual testing here -- is Toolbar the only thing affected? We should also be sure to test it in all themes as we've had theme-related regressions to toolbar before, and I see the patch is adding a library specifically for Seven only.

nod_’s picture

Issue tags: -Needs manual testing

Toolbar is not affected. The issue is about seven tabs, so we can't test in anything else than seven.

The lib added should have been added since the beginning.

Removing tag since I tested and profiled it in #6.

LewisNyman’s picture

Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs beta evaluation +frontend

Right, this only affects Seven as the intrinsic library was never used by any other core files. I've mirrored the intrinsic lib on Github so if anyone in looks for it it's easy to find.

Beta evaluation added.

xjm’s picture

Thanks @LewisNyman, knowing where the previous library was used (only in Seven) helps.

And how do we test it in seven? What are some steps to reproduce? Screenshots would be helpful too.

xjm’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs manual testing

There is still nothing on the issue documenting the actual change in behavior or where it happens, so requesting manual testing again.

xjm’s picture

Issue summary: View changes

I added the specific performance information to the beta eval.

nod_’s picture

Issue summary: View changes

Added info in beta eval.

@lewis, you probably don't want to have to support that lib, the jQuery API it's based on is going aways, see link in IS.

For testing, there is no change in behavior. The navigation menu in seven still collapses when the screen is narrow, it collapses at the exact same threshold as before. No UI change, the JS is just faster and requires less dependencies.

Manjit.Singh’s picture

@xjm manual testing of tabs on Chrome Device debugger tool, seems like fine in small resolution.

Ignore toolbar section, facing some problems due to toolbar while capturing screenshots. Just look into the tabs. ;)

nod_’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing

thanks for the screenshots!

xjm’s picture

Thanks @Manjit.Singh, that helps a ton to document that there's no regression. Also helps me understand what to test. :)

This issue is a prioritized change as per https://www.drupal.org/core/beta-changes (for the performance gain, the future-proofing, and the removed dependency), and its benefits outweigh any disruption. Committed and pushed to 8.0.x.

  • xjm committed 76fe710 on 8.0.x
    Issue #2474431 by droplet, nod_, Manjit.Singh: Better way to handle...

Status: Fixed » Closed (fixed)

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