Skip to content

Give headers their own mobile menu on WordPress 7.0 - #273

Open
amjadr360 wants to merge 9 commits into
mainfrom
feature/2485-header-mobile-menu
Open

amjadr360 wants to merge 9 commits into
mainfrom
feature/2485-header-mobile-menu

Conversation

@amjadr360

Copy link
Copy Markdown
Contributor

On phones, Atlas Beacon, Catalina Skyline and Ceadar Peak could squeeze or lose their header extra (the phone number, button or social icons). It happened when a site used a WordPress 7.0 mobile menu template, and between 600px and 782px.

These headers now ship their own WordPress 7.0 mobile menu (parts/mobile-menu.html). The extra lives in one shared parts/header-extras.html part used in both the bar and the menu, and the burger stays up to 782px. WordPress before 7.0 ignores the new settings and keeps today's menu, so nothing changes there. The other eight headers are untouched.

Catalina Skyline no longer ships default social icons in its bar; add them to Header Extras in the Site Editor.

How to test

  • WordPress 7.0+: each header with a phone, button or social icons. At 1280px the extra is in the bar. At 390px and 700px only the burger shows, and the open menu shows the extra once.
  • WordPress 6.8: all three headers behave as on main.

WordPress 7.0's overlay templates skip our copying script, so the
header's phone, button, or social extra stayed in the bar and got
squeezed between 600 and 782px with no burger to fall back on.

Ship that extra as real blocks in a header-extras part shared by the
bar and a new mobile-menu overlay, and keep the burger open through
that gap for headers using the overlay. Older WordPress keeps
today's copying script and CSS unchanged.
Both headers now set their navigation's overlay to the shared
mobile-menu part, closing the same 600-782px gap Ceadar Peak closed:
the burger stays up through that range instead of disappearing while
the header extra is hidden with nothing to reach it.

Atlas Beacon gets the header-extras part in its bar, same as Ceadar.
Catalina keeps its own inline social icons (its design when no extra
is picked) but swaps the unstyled ext-hidden/tablet:ext-flex classes
for real block-visibility metadata, so they actually leave the bar on
mobile and tablet instead of relying on a WordPress-7.0-only CSS rule
that deliberately stops once the overlay takes over.

Also scopes every dark-hero-over-full-screen-hero override in
style.css away from .ext-mobile-menu, the same way they're already
scoped away from .cloned-for-mobile: the new overlay sits inside the
header, so without the exclusion the hero's white-text rules were
bleeding into a menu that's meant to always open light.
A full read of the branch diff across all three phases turned up
nothing to clean up: the dark-hero exclusion list repeats across six
selectors only because plain CSS has no way to share it, and nothing
else duplicates, over-nests, or does extra work the codebase already
avoids.

The one thing left before merge was documentation, so this adds the
changelog line for Atlas Beacon, Catalina Skyline and Ceadar Peak's
new WordPress 7.0 mobile menu.
Catalina Skyline kept its own hardcoded social icons in the bar
instead of the shared header-extras part, so a different extra could
show in the bar than in the mobile menu, and the bar copy never got
the mobile/tablet hiding the other two headers have. It now points at
header-extras like Ceadar Peak and Atlas Beacon, so one copy feeds
both places.

The 600-782px forced-burger rule matched any navigation using a
WordPress 7.0 overlay, which would hijack a site owner's own overlay
template into our burger behaviour too. Both selectors now also
require .ext-mobile-menu, so only our own menu gets the extended
burger range.
Give the shared mobile-menu part the same band, round close chip and
hairline the pre-7.0 default overlay has always shown, so switching to
the new overlay is a visual no-op for site owners. The title shows
only on headers whose bar already carries one, with a fallback so a
header with no logo never shows an empty band. Phone and social-icon
sizing now matches what the old copying script gives the cloned menu.
The extra sat at the same 24px gap as the links themselves, so the
phone, button or social icons read as one more menu item. One spacing
step more sets them apart as their own group, in the mobile menu only.
Prettier split the inner group's style attribute across lines. Core
gives a border its solid style only when border-bottom-color starts
the attribute or follows a semicolon, so the divider under the menu's
logo row stopped drawing. The part goes back to its one-line markup.
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.

1 participant