Skip to content

Commit efc129c

Browse files
committed
Merge remote-tracking branch 'upstream/trunk' into feat/trac-64109-minify-twentytwentyone
2 parents d1286f9 + d3b793f commit efc129c

115 files changed

Lines changed: 3094 additions & 9837 deletions

File tree

Some content is hidden

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

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@ If this is your first time contributing, you may also find reviewing these guide
1212
- Inline Documentation Standards: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/
1313
- Browser Support Policies: https://make.wordpress.org/core/handbook/best-practices/browser-support/
1414
- Proper spelling and grammar related best practices: https://make.wordpress.org/core/handbook/best-practices/spelling/
15+
- ✨ If you are using AI tools, you must adhere to the AI Guidelines: https://make.wordpress.org/ai/handbook/ai-guidelines/
1516
-->
1617

1718
<!-- Insert a description of your changes here -->
1819

1920
Trac ticket: <!-- insert a link to the WordPress Trac ticket here -->
2021

22+
## Use of AI Tools
23+
24+
<!--
25+
You are free to use artificial intelligence (AI) tooling to contribute, but you must disclose what tooling you are using and to what extent a pull request has been authored by AI. It is your responsibility to review and take responsibility for what AI generates. See the WordPress AI Guidelines: <https://make.wordpress.org/ai/handbook/ai-guidelines/>.
26+
-->
27+
2128
---
2229
**This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See [GitHub Pull Requests for Code Review](https://make.wordpress.org/core/handbook/contribute/git/github-pull-requests-for-code-review/) in the Core Handbook for more details.**

.github/workflows/pull-request-comments.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ jobs:
167167
[WordPress Playground](https://developer.wordpress.org/playground/) is an experimental project that creates a full WordPress instance entirely within the browser.
168168
169169
### Some things to be aware of
170-
- The Plugin and Theme Directories cannot be accessed within Playground.
171170
- All changes will be lost when closing a tab with a Playground instance.
172171
- All changes will be lost when refreshing the page.
173172
- A fresh instance is created each time the link below is clicked.

package-lock.json

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

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://develop.svn.wordpress.org/trunk"
88
},
99
"gutenberg": {
10-
"ref": "7bf80ea84eb8b62eceb1bb3fe82e42163673ca79"
10+
"ref": "59a08c5496008ca88f4b6b86f38838c3612d88c8"
1111
},
1212
"engines": {
1313
"node": ">=20.10.0",
@@ -30,6 +30,7 @@
3030
"@lodder/grunt-postcss": "^3.1.1",
3131
"@playwright/test": "1.56.1",
3232
"@pmmmwh/react-refresh-webpack-plugin": "0.6.1",
33+
"@types/codemirror": "5.60.17",
3334
"@wordpress/e2e-test-utils-playwright": "1.33.2",
3435
"@wordpress/prettier-config": "4.33.1",
3536
"@wordpress/scripts": "30.26.2",
@@ -79,6 +80,7 @@
7980
"core-js-url-browser": "3.6.4",
8081
"csslint": "1.0.5",
8182
"element-closest": "3.0.2",
83+
"espree": "9.6.1",
8284
"esprima": "4.0.1",
8385
"formdata-polyfill": "4.0.10",
8486
"hoverintent": "2.2.1",

src/js/_enqueues/admin/site-health.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ jQuery( function( $ ) {
4444
$( '.health-check-accordion' ).on( 'click', '.health-check-accordion-trigger', function() {
4545
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
4646

47+
if ( $( this ).prop( 'id' ) ) {
48+
window.location.hash = $( this ).prop( 'id' );
49+
}
50+
4751
if ( isExpanded ) {
4852
$( this ).attr( 'aria-expanded', 'false' );
4953
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
@@ -53,6 +57,20 @@ jQuery( function( $ ) {
5357
}
5458
} );
5559

60+
/* global setTimeout */
61+
wp.domReady( function() {
62+
// Get hash from query string and open the related accordion.
63+
var hash = window.location.hash;
64+
65+
if ( hash ) {
66+
var requestedPanel = $( hash );
67+
68+
if ( requestedPanel.is( '.health-check-accordion-trigger' ) ) {
69+
requestedPanel.trigger( 'click' );
70+
}
71+
}
72+
} );
73+
5674
// Site Health test handling.
5775

5876
$( '.site-health-view-passed' ).on( 'click', function() {
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/**
2+
* CodeMirror JavaScript linter.
3+
*
4+
* @since 7.0.0
5+
*/
6+
7+
import CodeMirror from 'codemirror';
8+
9+
/**
10+
* CodeMirror Lint Error.
11+
*
12+
* @see https://codemirror.net/5/doc/manual.html#addon_lint
13+
*
14+
* @typedef {Object} CodeMirrorLintError
15+
* @property {string} message - Error message.
16+
* @property {'error'} severity - Severity.
17+
* @property {CodeMirror.Position} from - From position.
18+
* @property {CodeMirror.Position} to - To position.
19+
*/
20+
21+
/**
22+
* JSHint options supported by Espree.
23+
*
24+
* @see https://jshint.com/docs/options/
25+
* @see https://www.npmjs.com/package/espree#options
26+
*
27+
* @typedef {Object} SupportedJSHintOptions
28+
* @property {number} [esversion] - "This option is used to specify the ECMAScript version to which the code must adhere."
29+
* @property {boolean} [es5] - "This option enables syntax first defined in the ECMAScript 5.1 specification. This includes allowing reserved keywords as object properties."
30+
* @property {boolean} [es3] - "This option tells JSHint that your code needs to adhere to ECMAScript 3 specification. Use this option if you need your program to be executable in older browsers—such as Internet Explorer 6/7/8/9—and other legacy JavaScript environments."
31+
* @property {boolean} [module] - "This option informs JSHint that the input code describes an ECMAScript 6 module. All module code is interpreted as strict mode code."
32+
* @property {'implied'} [strict] - "This option requires the code to run in ECMAScript 5's strict mode."
33+
*/
34+
35+
/**
36+
* Validates JavaScript.
37+
*
38+
* @since 7.0.0
39+
*
40+
* @param {string} text - Source.
41+
* @param {SupportedJSHintOptions} options - Linting options.
42+
* @returns {Promise<CodeMirrorLintError[]>}
43+
*/
44+
async function validator( text, options ) {
45+
const errors = /** @type {CodeMirrorLintError[]} */ [];
46+
try {
47+
const espree = await import( /* webpackIgnore: true */ 'espree' );
48+
espree.parse( text, {
49+
...getEspreeOptions( options ),
50+
loc: true,
51+
} );
52+
} catch ( error ) {
53+
if (
54+
// This is an `EnhancedSyntaxError` in Espree: <https://github.com/brettz9/espree/blob/3c1120280b24f4a5e4c3125305b072fa0dfca22b/packages/espree/lib/espree.js#L48-L54>.
55+
error instanceof SyntaxError &&
56+
typeof error.lineNumber === 'number' &&
57+
typeof error.column === 'number'
58+
) {
59+
const line = error.lineNumber - 1;
60+
errors.push( {
61+
message: error.message,
62+
severity: 'error',
63+
from: CodeMirror.Pos( line, error.column - 1 ),
64+
to: CodeMirror.Pos( line, error.column ),
65+
} );
66+
} else {
67+
console.warn( '[CodeMirror] Unable to lint JavaScript:', error ); // jshint ignore:line
68+
}
69+
}
70+
71+
return errors;
72+
}
73+
74+
CodeMirror.registerHelper( 'lint', 'javascript', validator );
75+
76+
/**
77+
* Gets the options for Espree from the supported JSHint options.
78+
*
79+
* @since 7.0.0
80+
*
81+
* @param {SupportedJSHintOptions} options - Linting options for JSHint.
82+
* @return {{
83+
* ecmaVersion?: number|'latest',
84+
* ecmaFeatures?: {
85+
* impliedStrict?: true
86+
* }
87+
* }}
88+
*/
89+
function getEspreeOptions( options ) {
90+
const ecmaFeatures = {};
91+
if ( options.strict === 'implied' ) {
92+
ecmaFeatures.impliedStrict = true;
93+
}
94+
95+
return {
96+
ecmaVersion: getEcmaVersion( options ),
97+
sourceType: options.module ? 'module' : 'script',
98+
ecmaFeatures,
99+
};
100+
}
101+
102+
/**
103+
* Gets the ECMAScript version.
104+
*
105+
* @since 7.0.0
106+
*
107+
* @param {SupportedJSHintOptions} options - Options.
108+
* @return {number|'latest'} ECMAScript version.
109+
*/
110+
function getEcmaVersion( options ) {
111+
if ( typeof options.esversion === 'number' ) {
112+
return options.esversion;
113+
}
114+
if ( options.es5 ) {
115+
return 5;
116+
}
117+
if ( options.es3 ) {
118+
return 3;
119+
}
120+
return 'latest';
121+
}

src/js/_enqueues/wp/media/editor.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -703,15 +703,19 @@
703703
* Update the featured image id when the 'remove' link is clicked.
704704
*/
705705
init: function() {
706-
$('#postimagediv').on( 'click', '#set-post-thumbnail', function( event ) {
707-
event.preventDefault();
708-
// Stop propagation to prevent thickbox from activating.
709-
event.stopPropagation();
710-
711-
wp.media.featuredImage.frame().open();
712-
}).on( 'click', '#remove-post-thumbnail', function() {
713-
wp.media.featuredImage.remove();
714-
return false;
706+
$('#postimagediv').on( 'click keyup keydown', '#set-post-thumbnail', function( event ) {
707+
if ( ( event.type === 'keyup' && event.key === ' ' ) || ( event.type === 'keydown' && event.key === 'Enter' ) || event.type === 'click' ) {
708+
event.preventDefault();
709+
// Stop propagation to prevent thickbox from activating.
710+
event.stopPropagation();
711+
712+
wp.media.featuredImage.frame().open();
713+
}
714+
}).on( 'click keyup keydown', '#remove-post-thumbnail', function( event ) {
715+
if ( ( event.type === 'keyup' && event.key === ' ' ) || ( event.type === 'keydown' && event.key === 'Enter' ) || event.type === 'click' ) {
716+
wp.media.featuredImage.remove();
717+
return false;
718+
}
715719
});
716720
}
717721
};

src/js/_enqueues/wp/widgets/custom-html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ wp.customHtmlWidgets = ( function( $ ) {
333333
* This ensures that the textarea is visible and the editor can be initialized.
334334
*/
335335
renderWhenAnimationDone = function() {
336-
if ( ! ( wp.customize ? widgetContainer.parent().hasClass( 'expanded' ) : widgetContainer.hasClass( 'open' ) ) ) { // Core merge: The wp.customize condition can be eliminated with this change being in core: https://github.com/xwp/wordpress-develop/pull/247/commits/5322387d
336+
if ( ! ( wp.customize ? widgetContainer.parent().hasClass( 'expanded' ) : widgetContainer.hasClass( 'open' ) ) ) { // Core merge: The wp.customize condition can be eliminated with this change being in core: https://core.trac.wordpress.org/changeset/41260
337337
setTimeout( renderWhenAnimationDone, animatedCheckDelay );
338338
} else {
339339
widgetControl.initializeEditor();

src/js/media/views/media-frame.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{
101101
tabPanelEl = this.$el.find( '.media-frame-tab-panel' ),
102102
ariaLabelledby;
103103

104-
tabPanelEl.removeAttr( 'role aria-labelledby tabindex' );
104+
tabPanelEl.removeAttr( 'role aria-labelledby' );
105105

106106
if ( this.state().get( 'menu' ) && this.menuView && this.menuView.isVisible ) {
107107
ariaLabelledby = 'menu-item-' + stateId;
@@ -111,7 +111,6 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{
111111
.attr( {
112112
role: 'tabpanel',
113113
'aria-labelledby': ariaLabelledby,
114-
tabIndex: '0'
115114
} );
116115
}
117116
},
@@ -127,7 +126,7 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{
127126
var tabPanelEl = this.$el.find( '.media-frame-content' ),
128127
ariaLabelledby;
129128

130-
tabPanelEl.removeAttr( 'role aria-labelledby tabindex' );
129+
tabPanelEl.removeAttr( 'role aria-labelledby' );
131130

132131
// Set the tab panel attributes only if the tabs are visible.
133132
if ( this.state().get( 'router' ) && this.routerView && this.routerView.isVisible && this.content._mode ) {
@@ -137,7 +136,6 @@ MediaFrame = Frame.extend(/** @lends wp.media.view.MediaFrame.prototype */{
137136
.attr( {
138137
role: 'tabpanel',
139138
'aria-labelledby': ariaLabelledby,
140-
tabIndex: '0'
141139
} );
142140
}
143141
},

src/wp-admin/css/common.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
.screen-reader-text + .dashicons-external {
140140
margin-top: -1px;
141141
margin-left: 2px;
142+
text-decoration: none;
142143
}
143144

144145
.screen-reader-shortcut {

0 commit comments

Comments
 (0)