Fix performance, bugs, and side-effects with the new HeaderView.
Review Request #7214 — Created April 16, 2015 and submitted
The new HeaderView, which provides a responsive menu at the top of the
page, had some performance problems and negatively affected the
dashboard.While resizes were throttled, the callback ended up doing far too much
work when in non-mobile mode. It changed CSS on elements, changed
visibility, and set up animations, every time there was a resize. This
caused a lot of churn on the page, slowing resizes. This logic only
needed to happen when the mobile menu changed state, so we now prevent
it from happening unless we know we're changing that state. Resizes are
a lot faster after this.It also no longer wraps
$(window)
all the time, but instead keeps a
handle to a pre-wrapped$(window)
. That offers another speedup in the
resize handling.One of the styles applied in the resize handler was an 'overflow' on the
body element. If a page (such as the dashboard) had its own 'overflow'
property set, it would be overridden, breaking page layout. Instead of
hard-coding the default value when the mobile menu closes, we instead
remove our custom property, allowing the page to fall back on the CSS
rules.The last little fix is that the logo was set to navigate to the root of
the domain, instead of the site root, fixing the link on subdirectory
installs.
Tested resizing. Much smoother.
No longer hit issues with scrollbars appearing on the dashboard page. Verified
that the overflow property was no longer set unnecessarily.Tested that the logo link worked.