Skip to content

Commit 81f6961

Browse files
authored
Merge branch 'trunk' into fix/30049
2 parents 4a9cddf + 56b20ea commit 81f6961

File tree

74 files changed

+1452
-573
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1452
-573
lines changed

package-lock.json

Lines changed: 52 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,27 @@
8383
"@wordpress/api-fetch": "7.0.1",
8484
"@wordpress/autop": "4.0.1",
8585
"@wordpress/blob": "4.0.1",
86-
"@wordpress/block-directory": "5.0.2",
86+
"@wordpress/block-directory": "5.0.3",
8787
"@wordpress/block-editor": "13.0.2",
88-
"@wordpress/block-library": "9.0.2",
88+
"@wordpress/block-library": "9.0.3",
8989
"@wordpress/block-serialization-default-parser": "5.0.1",
9090
"@wordpress/blocks": "13.0.2",
9191
"@wordpress/commands": "1.0.2",
9292
"@wordpress/components": "28.0.2",
9393
"@wordpress/compose": "7.0.1",
9494
"@wordpress/core-commands": "1.0.2",
9595
"@wordpress/core-data": "7.0.2",
96-
"@wordpress/customize-widgets": "5.0.2",
96+
"@wordpress/customize-widgets": "5.0.3",
9797
"@wordpress/data": "10.0.2",
9898
"@wordpress/data-controls": "4.0.2",
9999
"@wordpress/dataviews": "2.0.2",
100100
"@wordpress/date": "5.0.1",
101101
"@wordpress/deprecated": "4.0.1",
102102
"@wordpress/dom": "4.0.1",
103103
"@wordpress/dom-ready": "4.0.1",
104-
"@wordpress/edit-post": "8.0.2",
105-
"@wordpress/edit-site": "6.0.2",
106-
"@wordpress/edit-widgets": "6.0.2",
104+
"@wordpress/edit-post": "8.0.3",
105+
"@wordpress/edit-site": "6.0.3",
106+
"@wordpress/edit-widgets": "6.0.3",
107107
"@wordpress/editor": "14.0.2",
108108
"@wordpress/element": "6.0.1",
109109
"@wordpress/escape-html": "3.0.1",

src/js/_enqueues/admin/common.js

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -902,27 +902,6 @@ $( function() {
902902
$document.trigger( 'wp-collapse-menu', { state: menuState } );
903903
});
904904

905-
/**
906-
* Handles the `aria-haspopup` attribute on the current menu item when it has a submenu.
907-
*
908-
* @since 4.4.0
909-
*
910-
* @return {void}
911-
*/
912-
function currentMenuItemHasPopup() {
913-
var $current = $( 'a.wp-has-current-submenu' );
914-
915-
if ( 'folded' === menuState ) {
916-
// When folded or auto-folded and not responsive view, the current menu item does have a fly-out sub-menu.
917-
$current.attr( 'aria-haspopup', 'true' );
918-
} else {
919-
// When expanded or in responsive view, reset aria-haspopup.
920-
$current.attr( 'aria-haspopup', 'false' );
921-
}
922-
}
923-
924-
$document.on( 'wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate', currentMenuItemHasPopup );
925-
926905
/**
927906
* Ensures an admin submenu is within the visual viewport.
928907
*
@@ -1695,8 +1674,10 @@ $( function() {
16951674
// Modify functionality based on custom activate/deactivate event.
16961675
$document.on( 'wp-responsive-activate.wp-responsive', function() {
16971676
self.activate();
1677+
self.toggleAriaHasPopup( 'add' );
16981678
}).on( 'wp-responsive-deactivate.wp-responsive', function() {
16991679
self.deactivate();
1680+
self.toggleAriaHasPopup( 'remove' );
17001681
});
17011682

17021683
$( '#wp-admin-bar-menu-toggle a' ).attr( 'aria-expanded', 'false' );
@@ -1748,7 +1729,7 @@ $( function() {
17481729
setTimeout( function() {
17491730
var focusIsInToggle = $.contains( toggleButton, focusedElement );
17501731
var focusIsInSidebar = $.contains( sidebar, focusedElement );
1751-
1732+
17521733
if ( ! focusIsInToggle && ! focusIsInSidebar ) {
17531734
$( toggleButton ).trigger( 'click.wp-responsive' );
17541735
}
@@ -1762,8 +1743,9 @@ $( function() {
17621743
if ( ! $adminmenu.data('wp-responsive') ) {
17631744
return;
17641745
}
1765-
1746+
let state = ( 'false' === $( this ).attr( 'aria-expanded' ) ) ? 'true' : 'false';
17661747
$( this ).parent( 'li' ).toggleClass( 'selected' );
1748+
$( this ).attr( 'aria-expanded', state );
17671749
$( this ).trigger( 'focus' );
17681750
event.preventDefault();
17691751
});
@@ -1837,6 +1819,34 @@ $( function() {
18371819
this.maybeDisableSortables();
18381820
},
18391821

1822+
/**
1823+
* Toggles the aria-haspopup attribute for the responsive admin menu.
1824+
*
1825+
* The aria-haspopup attribute is only necessary for the responsive menu.
1826+
* See ticket https://core.trac.wordpress.org/ticket/43095
1827+
*
1828+
* @since 6.6.0
1829+
*
1830+
* @param {string} action Whether to add or remove the aria-haspopup attribute.
1831+
*
1832+
* @return {void}
1833+
*/
1834+
toggleAriaHasPopup: function( action ) {
1835+
var elements = $adminmenu.find( '[data-ariahaspopup]' );
1836+
1837+
if ( action === 'add' ) {
1838+
elements.each( function() {
1839+
$( this ).attr( 'aria-haspopup', 'menu' ).attr( 'aria-expanded', 'false' );
1840+
} );
1841+
1842+
return;
1843+
}
1844+
1845+
elements.each( function() {
1846+
$( this ).removeAttr( 'aria-haspopup' ).removeAttr( 'aria-expanded' );
1847+
} );
1848+
},
1849+
18401850
/**
18411851
* Sets the responsiveness and enables the overlay based on the viewport width.
18421852
*
@@ -2034,7 +2044,6 @@ $( function() {
20342044
window.wpResponsive.init();
20352045
setPinMenu();
20362046
setMenuState();
2037-
currentMenuItemHasPopup();
20382047
makeNoticesDismissible();
20392048
aria_button_if_js();
20402049

0 commit comments

Comments
 (0)