Skip to content

Remove the Aludra dependency from the shipped theme (4.9.2) - #107

Merged
jasperf merged 5 commits into
mainfrom
fix/search-overlay-without-aludra
Aug 25, 2026
Merged

jasperf merged 5 commits into
mainfrom
fix/search-overlay-without-aludra

Conversation

@jasperf

@jasperf jasperf commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Elayne 4.9.1 is live on wordpress.org, and the zip it serves depends on a plugin that isn't in the plugin directory. Anyone who installs the theme from wordpress.org and inserts the Double Bar Header gets a block-error placeholder where the search icon belongs.

Problem

Two Aludra dependencies ship in the released theme — not one. The second was missed on the first pass because it isn't a block reference at all:

File Dependency Symptom without Aludra
patterns/header-double-bar.php aludra/search-overlay-trigger block Visible block-error placeholder
parts/mega-menu-template.html core/patternaludra/mega-menu-featured-content Silently empty template part

Both are in the published 4.9.1 zip:

$ curl -sL https://downloads.wordpress.org/theme/elayne.4.9.1.zip -o elayne.zip
$ unzip -p elayne.zip 'elayne/patterns/header-double-bar.php' | grep -c 'wp:aludra/'
2
$ unzip -l elayne.zip | grep mega-menu
      66  07-28-2026 03:07   elayne/parts/mega-menu-template.html

core/pattern renders nothing when its slug isn't registered, which is why the mega menu one never got reported — it fails silently rather than visibly. Anyone auditing the sibling themes should grep for aludra, not wp:aludra/.

Aludra is not in the plugin directory, so this can't be resolved by recommending it:

$ curl -s https://api.wordpress.org/plugins/info/1.0/aludra.json
{"error":"Plugin not found."}

Approach

The overlay moves into the theme rather than the pattern losing its search. Three things improve over the block being replaced:

aludra/search-overlay-trigger this
Trigger element <figure> — not keyboard-reachable <button>
Overlay markup assembled from a JS template string rendered in PHP — translatable
Focus none Tab trapped while open, restored on close

Loading only where needed. A header pattern renders on every page, so there's no page-level condition to gate on the way category-filter-drawer.js gates on WooCommerce archives. Instead search-overlay.js is registered on wp_enqueue_scripts and enqueued from render_block() only when a trigger actually renders; the footer markup is gated by the same flag. Only core/html blocks are inspected, keeping the filter off the hot path for every other block. Block rendering happens before wp_footer, so a script registered $in_footer = true still prints correctly.

Sites that don't use the pattern load nothing — no script, no overlay markup.

No dead control without JS. The trigger ships with hidden and the script reveals it, so a visitor with JS disabled sees no button rather than one that does nothing. That script doesn't run in the editor, so an editor-only rule in assets/css/editor.css reveals it there — otherwise the pattern's top bar would look like it was missing its search icon while being edited.

Mega menu part is inlined as core blocks. Two things from the Aludra original were deliberately not copied: the placehold.co image, since a theme may not reference external resources, and is-style-list-plain-no-indent, which is a block style Aludra registers and Elayne does not.

Result

$ grep -rn -i 'aludra' patterns templates parts styles theme.json functions.php inc assets
(0 results)

Every pattern and template part now renders correctly without the plugin. Aludra stays a genuinely optional companion — README's Lineage note, Requirements list and companion-plugin section have been corrected accordingly, since all three described it as supplying Elayne's content blocks.

Also bumps Tested up to 7.0 → 7.1. Requires at least stays 6.6 — render_block is WP 5.0 and the mega menu part's grid layout is 6.3, so nothing here needs newer.

Test plan

  • PHPCS clean on new files (composer run wpcs:scan); the two pattern errors are pre-existing on all 121 patterns, which is why wpcs:scan excludes */patterns/*
  • composer run lint clean; node --check assets/js/search-overlay.js clean
  • Version in sync across style.css, readme.txt, package.json, CHANGELOG.md
  • Browser: open/close via trigger, ESC, backdrop, close button; Tab stays inside the overlay; focus returns to the trigger on close
  • Browser: trigger hidden with JS disabled; visible in the editor
  • Browser: no search-overlay.js request on a page without the pattern
  • Browser: mega menu template part renders with Aludra deactivated

Browser testing is still outstanding — the Trellis VM was down when this was prepared.

Replaces aludra/search-overlay-trigger, which the header-double-bar
pattern depended on. Three changes over the block it replaces:

- The trigger is a real <button>, not a <figure>, so it is
  keyboard-reachable. It also traps Tab while the overlay is open and
  restores focus to the trigger on close.
- The overlay markup is rendered in PHP rather than assembled from a
  JavaScript string, so its strings are translatable.
- The script is registered on wp_enqueue_scripts but enqueued from
  render_block() only when a trigger is actually rendered, and the
  footer markup is gated the same way, so sites that do not use the
  pattern load nothing extra. Only core/html blocks are inspected,
  keeping the filter off the hot path for every other block.

The trigger ships hidden and is revealed by the script, so it is never
a dead control without JavaScript; an editor-only rule reveals it while
editing, where the script does not run.
The top bar's search icon was the theme's only aludra/* block, and it
ships in the WordPress.org release — so inserting this pattern without
the Aludra plugin installed rendered a block-error placeholder where
the search icon belongs. Points at the theme's own trigger instead,
making the pattern core-blocks-only like the other 120.
The part was a single core/pattern block pointing at
aludra/mega-menu-featured-content, so on a site without Aludra the Mega
Menu template part rendered as nothing at all — silently empty rather
than a visible block error, which is why it went unnoticed alongside
the header trigger.

Inlines the equivalent composition in core blocks. Two things from the
Aludra original were deliberately not copied: the placehold.co image,
since a theme may not reference external resources, and the
is-style-list-plain-no-indent class, which is a block style Aludra
registers and Elayne does not.
The Lineage note, Requirements list and companion-plugin section all
said Elayne's content blocks come from Aludra. Nothing Elayne ships
references an aludra/* block or pattern any more, so every pattern and
template part renders correctly without it.
Also bumps Tested up to from 7.0 to 7.1. Requires at least stays at
6.6 — nothing in this release needs newer.
@jasperf

jasperf commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Verified end-to-end on the demo, with Aludra inactive

aludra confirmed inactive on the demo network, so this exercises exactly the wordpress.org user's situation.

/legal/'s header template part still held the retired elayne-blocks elayne/search-overlay-trigger block in the database — a separate, older problem from the one this PR fixes, and the actual cause of that site's dead search bar. Patterns are copied into template parts at insert time, so editing the pattern file could never fix an existing copy. Repointing that stored part at the new trigger gave a real page to test against:

URL                                    trigger  script  overlay
http://demo.imagewize.test/               0        0        0
http://demo.imagewize.test/spa/           0        0        0
http://demo.imagewize.test/legal/         1        1        1

Conditional loading works. search-overlay.js?ver=4.9.2 is requested only on the page that actually renders a trigger — render_block() detection fires, and the wp_footer overlay is gated by the same flag. Pages without the pattern carry no script and no extra markup.

Rendered overlay on /legal/:

role="dialog"                1
aria-modal="true"            1
elayne-search-overlay__field 1
elayne-search-overlay__close 1
block errors                 0
old elayne-blocks markup     0

wp-pattern-sentinel also passes the changed pattern against the live install:

✓ PASS  header-double-bar.php  (68199ms)
Patterns: 1   Passed: 1   Failed: 0   Errors: 0   Warnings: 0

Still unverified

Everything above is server-rendered output checked over HTTP. The interactive behaviour — click to open, ESC, backdrop click, Tab trapped inside the overlay, focus returning to the trigger on close, and the trigger staying hidden with JS disabled — needs a real browser and has not been exercised yet.

@jasperf
jasperf merged commit cf2aeeb into main Aug 25, 2026
3 checks passed
@jasperf
jasperf deleted the fix/search-overlay-without-aludra branch August 25, 2026 05:39
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