Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use defer loading strategy for frontend view scripts #52536

Merged
merged 28 commits into from
Jul 25, 2023
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7e469ec
Load interactivity API scripts with defer loading strategy
westonruter Jul 11, 2023
23b7aad
Load comment-reply script with defer loading strategy
westonruter Jul 11, 2023
aefd67a
Load search view script with defer loading strategy
westonruter Jul 11, 2023
f89e31a
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into a…
westonruter Jul 12, 2023
3dd37c2
Defer the view scripts for the Navigation and File blocks
westonruter Jul 12, 2023
4f7301b
Use DCA event instead of window load event for Navigation viewScripts
westonruter Jul 13, 2023
3e7c73e
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into a…
westonruter Jul 13, 2023
34faf8f
Optimize submenu-on-click view script
westonruter Jul 13, 2023
5329284
Optimize modal view script
westonruter Jul 13, 2023
2bafd37
Utilize asset file for wp-block--search-view
westonruter Jul 13, 2023
4b86ce4
Conditionally enqueue navigation view scripts only if needed
westonruter Jul 13, 2023
95beb24
Update Navigation block to remove/add view scripts in the same way th…
westonruter Jul 13, 2023
404128f
Update Search block to include view script in same way as File block …
westonruter Jul 13, 2023
4ccd709
Refactor Search block view script
westonruter Jul 14, 2023
b7863e9
Use more DOM properties instead of attributes
westonruter Jul 14, 2023
c41d35b
Use more precise reflected terminology
westonruter Jul 14, 2023
b50a2b8
Remove resolved TODO comment
westonruter Jul 14, 2023
a18d055
Use event delegation to open MicroModal
westonruter Jul 14, 2023
712c4cf
Remove excessive type check
westonruter Jul 14, 2023
b2db932
Fix closing submenus when there are multiple Navigation blocks on a page
westonruter Jul 14, 2023
4a7fc46
Clarify block.json comment
westonruter Jul 14, 2023
7fe5534
Merge branch 'trunk' into add/defer-script-loading-strategy
westonruter Jul 18, 2023
ffd9e5c
Add core merge note for comment-reply script strategy
westonruter Jul 18, 2023
26c06ab
Use defer strategy instead of async for Navigation and Search blocks
westonruter Jul 20, 2023
86b8e36
Defer all block view scripts
westonruter Jul 20, 2023
aab0b4b
Ensure interactivity scripts remain in footer in WP<6.3
westonruter Jul 20, 2023
73e3564
Remove defer from comment-reply for now
westonruter Jul 20, 2023
da2380a
Merge remote-tracking branch 'origin/trunk' into add/defer-script-loa…
westonruter Jul 20, 2023
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
Prev Previous commit
Next Next commit
Use more DOM properties instead of attributes
  • Loading branch information
westonruter committed Jul 14, 2023
commit b7863e9c2bcdc9e4a0dc78a3a6769436be0fc167
11 changes: 6 additions & 5 deletions packages/block-library/src/search/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ function expandSearchBlock( block ) {
const searchField = getSearchInput( block );
const searchButton = getSearchButton( block );

searchField.removeAttribute( 'aria-hidden' );
searchField.removeAttribute( 'tabindex' );
searchButton.removeAttribute( 'aria-expanded' );
searchButton.removeAttribute( 'aria-controls' );
searchButton.type = 'submit';
searchField.ariaHidden = 'false';
searchField.tabIndex = 0;
searchButton.ariaExpanded = 'true';
searchButton.removeAttribute( 'aria-controls' ); // Note: Seemingly not mirrored with searchButton.ariaControls.
toggleAriaLabel( searchButton );
block.classList.remove( hiddenClass );

Expand Down Expand Up @@ -123,11 +123,12 @@ function collapseExpandedSearchBlock() {
const block = expandedSearchBlock;
const searchField = getSearchInput( block );
const searchButton = getSearchButton( block );

searchButton.type = 'button';
searchField.ariaHidden = 'true';
searchField.tabIndex = -1;
searchButton.ariaExpanded = 'false';
searchButton.ariaControls = searchField.getAttribute( 'id' );
searchButton.setAttribute( 'aria-controls', searchField.id ); // Note: Seemingly not mirrored with searchButton.ariaControls.
toggleAriaLabel( searchButton );
block.classList.add( hiddenClass );

Expand Down