fix: make CHRNX header fully progressive

This commit is contained in:
chrnx committed 2026-08-11 17:26:48 -05:00
1 parent e1579657d6
commit f983cec4f9
13 files changed
+414 -36

No files matched your search

+20
View File
@@ -75,4 +75,24 @@ describe( 'progressive mobile navigation', () => {
expect( document.querySelector( '[data-chrnx-menu-toggle]' ).hidden ).toBe( true );
expect( document.documentElement.classList ).toContain( 'chrnx-navigation-enhanced' );
} );
test( 'resize moves focus out of a navigation that becomes hidden', () => {
const { initialize } = require( modulePath );
const media = createMedia( false );
initialize( { document, media } );
const button = document.querySelector( '[data-chrnx-menu-toggle]' );
const nav = document.querySelector( 'nav' );
nav.querySelector( 'a' ).focus();
media.change( true );
expect( nav.hidden ).toBe( true );
expect( button.hidden ).toBe( false );
expect( document.activeElement ).toBe( button );
button.click();
nav.querySelector( 'a' ).focus();
media.change( false );
expect( nav.hidden ).toBe( false );
expect( button.hidden ).toBe( true );
expect( document.activeElement ).toBe( nav.querySelector( 'a' ) );
} );
} );