Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/js/_enqueues/lib/nav-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,12 @@

// Prevent focused element from being hidden by the sticky footer.
$( '.menu-edit a, .menu-edit button, .menu-edit input, .menu-edit textarea, .menu-edit select' ).on('focus', function() {
// The sticky footer's own controls are always in view, so scrolling
// to reveal them would shift the footer out from under the pointer
// mid-click and drop the Save or Delete activation. See #65684.
if ( $( this ).closest( '#nav-menu-footer' ).length ) {
return;
}
if ( window.innerWidth >= 783 ) {
var navMenuHeight = $( '#nav-menu-footer' ).height() + 20;
var bottomOffset = $(this).offset().top - ( $(window).scrollTop() + $(window).height() - $(this).height() );
Expand Down
22 changes: 3 additions & 19 deletions tests/e2e/specs/classic-menus.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,8 @@
).toBeVisible();

// Assign the menu to the theme's primary location and save.
const primaryMenu = page.getByRole( 'checkbox', {
name: 'Primary menu',
} );
// Use the keyboard to avoid the focus-induced scroll described in #65684.
await primaryMenu.focus();
await page.keyboard.press( 'Space' );
await expect( primaryMenu ).toBeChecked();

// Activate via keyboard: the sticky footer bar can shift on focus
// and swallow the first pointer click at certain window heights.
// See https://core.trac.wordpress.org/ticket/65684.
await page.locator( '#save_menu_footer' ).focus();
await page.keyboard.press( 'Enter' );
await page.getByRole( 'checkbox', { name: 'Primary menu' } ).check();

Check failure on line 57 in tests/e2e/specs/classic-menus.test.js

View workflow job for this annotation

GitHub Actions / E2E Tests / parallel, SCRIPT_DEBUG enabled

[parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu

1) [parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu, adds a custom link, and assigns it to a location Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.check: Clicking the checkbox did not change its state Call log: - waiting for getByRole('checkbox', { name: 'Primary menu' }) - locator resolved to <input value="4" type="checkbox" id="locations-primary" name="menu-locations[primary]"/> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - performing click action - click action done - waiting for scheduled navigations to finish - navigations have finished 55 | 56 | // Assign the menu to the theme's primary location and save. > 57 | await page.getByRole( 'checkbox', { name: 'Primary menu' } ).check(); | ^ 58 | await page.locator( '#save_menu_footer' ).click(); 59 | 60 | // The location assignment persists. at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/classic-menus.test.js:57:64

Check failure on line 57 in tests/e2e/specs/classic-menus.test.js

View workflow job for this annotation

GitHub Actions / E2E Tests / parallel, SCRIPT_DEBUG enabled

[parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu

1) [parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu, adds a custom link, and assigns it to a location Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.check: Clicking the checkbox did not change its state Call log: - waiting for getByRole('checkbox', { name: 'Primary menu' }) - locator resolved to <input value="3" type="checkbox" id="locations-primary" name="menu-locations[primary]"/> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - performing click action - click action done - waiting for scheduled navigations to finish - navigations have finished 55 | 56 | // Assign the menu to the theme's primary location and save. > 57 | await page.getByRole( 'checkbox', { name: 'Primary menu' } ).check(); | ^ 58 | await page.locator( '#save_menu_footer' ).click(); 59 | 60 | // The location assignment persists. at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/classic-menus.test.js:57:64

Check failure on line 57 in tests/e2e/specs/classic-menus.test.js

View workflow job for this annotation

GitHub Actions / E2E Tests / parallel, SCRIPT_DEBUG enabled

[parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu

1) [parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu, adds a custom link, and assigns it to a location Error: locator.check: Clicking the checkbox did not change its state Call log: - waiting for getByRole('checkbox', { name: 'Primary menu' }) - locator resolved to <input value="2" type="checkbox" id="locations-primary" name="menu-locations[primary]"/> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - performing click action - click action done - waiting for scheduled navigations to finish - navigations have finished 55 | 56 | // Assign the menu to the theme's primary location and save. > 57 | await page.getByRole( 'checkbox', { name: 'Primary menu' } ).check(); | ^ 58 | await page.locator( '#save_menu_footer' ).click(); 59 | 60 | // The location assignment persists. at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/classic-menus.test.js:57:64

Check failure on line 57 in tests/e2e/specs/classic-menus.test.js

View workflow job for this annotation

GitHub Actions / E2E Tests / parallel, SCRIPT_DEBUG disabled

[parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu

1) [parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu, adds a custom link, and assigns it to a location Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.check: Clicking the checkbox did not change its state Call log: - waiting for getByRole('checkbox', { name: 'Primary menu' }) - locator resolved to <input value="4" type="checkbox" id="locations-primary" name="menu-locations[primary]"/> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - performing click action - click action done - waiting for scheduled navigations to finish - navigations have finished 55 | 56 | // Assign the menu to the theme's primary location and save. > 57 | await page.getByRole( 'checkbox', { name: 'Primary menu' } ).check(); | ^ 58 | await page.locator( '#save_menu_footer' ).click(); 59 | 60 | // The location assignment persists. at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/classic-menus.test.js:57:64

Check failure on line 57 in tests/e2e/specs/classic-menus.test.js

View workflow job for this annotation

GitHub Actions / E2E Tests / parallel, SCRIPT_DEBUG disabled

[parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu

1) [parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu, adds a custom link, and assigns it to a location Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: locator.check: Clicking the checkbox did not change its state Call log: - waiting for getByRole('checkbox', { name: 'Primary menu' }) - locator resolved to <input value="3" type="checkbox" id="locations-primary" name="menu-locations[primary]"/> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - performing click action - click action done - waiting for scheduled navigations to finish - navigations have finished 55 | 56 | // Assign the menu to the theme's primary location and save. > 57 | await page.getByRole( 'checkbox', { name: 'Primary menu' } ).check(); | ^ 58 | await page.locator( '#save_menu_footer' ).click(); 59 | 60 | // The location assignment persists. at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/classic-menus.test.js:57:64

Check failure on line 57 in tests/e2e/specs/classic-menus.test.js

View workflow job for this annotation

GitHub Actions / E2E Tests / parallel, SCRIPT_DEBUG disabled

[parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu

1) [parallel] › tests/e2e/specs/classic-menus.test.js:16:6 › Classic Menus › creates a menu, adds a custom link, and assigns it to a location Error: locator.check: Clicking the checkbox did not change its state Call log: - waiting for getByRole('checkbox', { name: 'Primary menu' }) - locator resolved to <input value="2" type="checkbox" id="locations-primary" name="menu-locations[primary]"/> - attempting click action - waiting for element to be visible, enabled and stable - element is visible, enabled and stable - scrolling into view if needed - done scrolling - performing click action - click action done - waiting for scheduled navigations to finish - navigations have finished 55 | 56 | // Assign the menu to the theme's primary location and save. > 57 | await page.getByRole( 'checkbox', { name: 'Primary menu' } ).check(); | ^ 58 | await page.locator( '#save_menu_footer' ).click(); 59 | 60 | // The location assignment persists. at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/classic-menus.test.js:57:64
await page.locator( '#save_menu_footer' ).click();

// The location assignment persists.
await expect
Expand Down Expand Up @@ -102,12 +91,7 @@

// Deleting asks for confirmation.
page.on( 'dialog', ( dialog ) => dialog.accept() );

// Activate via keyboard: the sticky footer bar can shift on focus
// and swallow the first pointer click at certain window heights.
// See https://core.trac.wordpress.org/ticket/65684.
await page.getByRole( 'link', { name: 'Delete Menu' } ).focus();
await page.keyboard.press( 'Enter' );
await page.getByRole( 'link', { name: 'Delete Menu' } ).click();

// With the only menu gone, the screen returns to the create form.
await expect(
Expand Down
Loading