From 36b008d79e806304c045da2eea9ae2b893525a5a Mon Sep 17 00:00:00 2001 From: rg755421 Date: Wed, 30 Sep 2026 10:12:26 +0545 Subject: [PATCH 1/2] Fix - Guard the touch submenu handler in navigation.js when #site-navigation is missing (themegrill/radiate-pro#28) Co-Authored-By: Claude Sonnet 5.5 --- js/navigation.js | 4 +++ .../navigation-missing-container.spec.ts | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/e2e/specs/mobile-menu/navigation-missing-container.spec.ts diff --git a/js/navigation.js b/js/navigation.js index d276f4a..5b773bd 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -81,6 +81,10 @@ jQuery(document).ready(function() { var container; container = document.getElementById( 'site-navigation' ); + if ( ! container ) { + return; + } + /** * Toggles `focus` class to allow submenu access on tablets. */ diff --git a/tests/e2e/specs/mobile-menu/navigation-missing-container.spec.ts b/tests/e2e/specs/mobile-menu/navigation-missing-container.spec.ts new file mode 100644 index 0000000..a629e1b --- /dev/null +++ b/tests/e2e/specs/mobile-menu/navigation-missing-container.spec.ts @@ -0,0 +1,34 @@ +import { test, expect } from "../../fixtures"; + +/** + * @area mobile-menu + * @tier fresh + * @guards themegrill/radiate-pro#28 + * @source fix/28-navigation-guard 2026-09-30; js/navigation.js + * @why The touch-submenu handler in navigation.js read #site-navigation + * without a null check (the first handler already had one), so any page + * without that element (a child theme whose header.php drops the nav) + * threw "Cannot read properties of null (reading 'querySelectorAll')". + * Removes the