Make WordPress Core

Opened 4 weeks ago

Closed 4 weeks ago

#63032 closed enhancement (fixed)

Adjust speculative loading selector exclusions to allow for classes to apply on parent element

Reported by: flixos90's profile flixos90 Owned by: flixos90's profile flixos90
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch has-unit-tests
Focuses: performance Cc:

Description

The speculative loading implementation in Core, as one of the lesser discussed features, currently excludes any links from prerendering that use a no-prerender class on them, and it excludes any links from prefetching that use either a no-prefetch or a no-prerender class on them.

In the current implementation, this may be beneficial for some plugins or classic themes, but it misses out on another valuable opportunity, which is block themes. Many blocks allow adding a custom class to the block wrapper element itself, and this would be a perfect candidate to allow advanced end user customization of speculative loading. But there is no UI to add a class to a link (a) specifically.

While WordPress Core's philosophy is "decisions, not options", the UI to add a class is in itself already considered advanced, so allowing it to control this kind of exclusion would make sense.

And it's an easy win: All we need to do is to also allow the exclusion for .no-prefetch a and .no-prerender a, instead of just .no-prefetch and .no-prerender.

Also see the related discussion in https://github.com/WordPress/performance/issues/1156#issuecomment-2616505930. It includes additional classes, but those are out of scope for this ticket as they require more discussion. This ticket is merely about "fixing" the current exclusions to be controllable via the block class UI.

Change History (2)

This ticket was mentioned in PR #8428 on WordPress/wordpress-develop by @flixos90.


4 weeks ago
#1

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed

#2 @flixos90
4 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 59881:

General: Allow speculative loading opt-out CSS classes to be applied on parent element, e.g. at the block level.

Follow-up to [59837].

Props flixos90, westonruter.
Fixes #63032.
See #62503.

Note: See TracTickets for help on using tickets.