Bug Scrub Schedule for 5.4

Now that 5.4 has been officially kicked off, bug scrubs will happen weekly all the way up to the final release. Keep an eye on this schedule – it will change often to reflect the latest information.

  1. 1/21/2020 19:00 UTC
  2. 1/29/2020 23:00 UTC
  3. 2/7/2020 05:00 UTC (APAC-Friendly)
  4. 2/10/2020 16:00 UTC
  5. 2/18/2020 20:00 UTC
  6. 2/27/2020 23:00 UTC
  7. 3/2/2020 16:00 UTC
  8. 3/11/2020 TBD (If Necessary)
  9. 3/17/2020 TBD (If Necessary)
  10. 3/27/2020 TBD (If Necessary)
  11. 3/30/2020 TBD (If Necessary)

These scrubs are separate and in addition to the normal scrubbing and triage by individual components. Some of those sessions include:

Design Triage: Every Monday 17:30 UTC at #design
Gutenberg Design Triage: Every Tuesday 17:00 UTC at #design
Accessibility Scrub: Every Friday 14:00 UTC at #accessibility

Also, the ongoing APAC-friendly #core bug scrub session every Thursday at 06:00 UTC will continue during the cycle, alternating focus between core and editor.

Next, the Accessibility team has announced a few extra scrubs for the 5.4 cycle. You can read about those here.

Finally, a reminder that anyone — Yes, you! — can host a bug scrub at anytime. You can work through any tickets you’re comfortable with. In fact, if you plan one that’s 5.4-focused, we’ll add it to the schedule here along with your name. Finally, you’ll get well deserved props in the weekly Dev Chat, as well as in the #props Slack channel!

All open tickets for 5.4, in order of priority, can be found here. Tickets that haven’t seen any love in a while are in particular need. Those can be found in this query.

If you’d like to lead a bug scrub or have any questions or concerns about the schedule, please leave a comment or reach out to me directly.

#5-4, #bug-scrub

Dev Chat Agenda for February 19, 2020 (5.4 Week 6)

Here is the agenda for the weekly meeting happening later today: Wednesday, February 19, 2020, at 09:00 PM UTC.

Announcements

  • This week marks week 5 of the 5.4 release cycle 🙌
  • WordPress 5.4 Beta 2 was released yesterday, February 18, as scheduled.

Highlighted Blog Posts

Upcoming Releases – 5.4

  • Beta 3 to be released on February 25
  • Status report on the About page – content and design
  • Dev Notes status and how to proceed to get them all published in time for RC1 and the Field Guide

Components Check-in

  • News from components
  • Components up for adoption (Filesystem API and Rewrite Rules)
  • Components that need help
  • Cross component collaboration

Open Floor


If you have anything to propose for the agenda or specific items related to those listed above, please leave a comment below.

This meeting is held in the #core channel. To join the meeting, you’ll need an account on the Making WordPress Slack.

#5-4, #agenda, #devchat

Block Editor Keyboard Shortcuts in WordPress 5.4

In WordPress 5.4 a new package called @wordpress/keyboard-shortcuts has been introduced to centralize the registration/removal and documentation of the available keyboard shortcuts in the block editor screen.

Registering shortcuts

Registration of keyboard shortcuts should happen when first loading the screen/plugin. This can be achieved by calling the registerShortcut action.

wp.data.dispatch( 'core/keyboard-shortcuts' ).registerShortcut( {
	// Shortcut name (identifier)
	name: 'plugin/shortcut-name',

 	// Catergory (global, block or selection)
	category: 'block',

	// Description 
	description: 'Short description of your shortcut.',

	// The key combination used to trigger the shortcut
	// Could be just a single character or a character with
	// a modifier.
	keyCombination: {
		modifier: 'primaryAlt',
		character: 't',
	},

	// Some shortcuts can be triggered using several 
	// key combination, the aliases array is used to define
	// the alternative combinations
	aliases: [
		{
			modifier: 'primary',
			character: 'i',
		},
	],
} );

Registering a shortcut automatically add it to the keyboard shortcuts help modal to ensure its discoverability.

Implementing the keyboard shortcut behavior

The @wordpress/keyboard-shortcuts package also provides the useShortcut React hook to define the behavior triggered by the keyboard shortcuts.

import { useShortcut } from '@wordpress/keyboard-shortcuts';
import { useCallback } from '@wordpress/element';

const MyComponent = () => {
	useShortcut(
		// Shortcut name
		'plugin/shortcut-name',

		// Shortcut callback
		useCallback(
			( event ) => {
				// Do something when the keyboard 
				// shortcut is triggered
			},
			[]
		)
	);
}

Using this React hook instead of a custom implementation comes with a few advantages:

  • If the shortcut is unregistered by a third-party plugin, the callback is just ignored.
  • The shortcut key combination can be modified at runtime and the callback will still be called properly.

Removing existing shortcuts

Registered shortcuts can also be unregistered (and potentially replaced) by third-party plugins

wp.data.dispatch( 'core/keyboard-shortcuts' ).unregisterShortcut(
	'plugin/shortcut-name'
);

Next steps

In the next releases, this package will also allow offering a centralized UI to modify the keyboard shortcuts per user.

#5-4, #accessibility, #block-editor, #dev-notes

Enhancements to favicon handling in WordPress 5.4

WordPress 3.0 introduced wp_favicon_request() to avoid the performance hit that comes from serving a full 404 page on every favicon request. While that function works as intended, it doesn’t offer enough flexibility.

As of WordPress 5.4, theme and plugin authors can manage favicon requests much more flexibly, with the following logic:

  • If there is a Site Icon set in Customizer, redirect /favicon.ico requests to that icon.
  • Otherwise, use the WordPress logo as a default icon.
  • If a physical /favicon.ico file exists, do nothing and let the server handle the request.

This logic will only work if WordPress is installed in the root directory.

With these changes, /favicon.ico handling is now more consistent with /robots.txt requests.

New functions & hooks

WordPress 5.4 introduces a bunch of new functions and hooks for favicon handling:

  • is_favicon() conditional tag to complement is_robots().
  • do_favicon action to complement do_robots and use it in template loader. This hook will be fired when the template loader determines a favicon request.
  • do_favicon() function, hooked to the above action by default, to complement do_robots().
  • do_faviconico action to complement do_robotstxt, for plugins and themes to override the default behavior. This hook will be fired when displaying the favicon file.

With the above logic, do_favicon redirects to the Site Icon if it exists, or to WordPress logo as a default icon, using the following code:

function do_favicon() {
    /**
     * Fires when serving the favicon.ico file.
     *
     * @since 5.4.0
     */
    do_action( 'do_faviconico' );

    wp_redirect( get_site_icon_url( 32, admin_url( 'images/w-logo-blue.png' ) ) );
    exit;
}

Themes and plugins developers can use do_faviconico action to override the default behavior.

Deprecations

  • wp_favicon_request() is now deprecated in favor of do_favicon().

For reference, see the related ticket on WordPress Core Trac: #47398

#5-4, #dev-notes, #favicon

Editor Chat Agenda: 19th February, 2020

Note taker: @pbrocks

This is the agenda for the weekly editor chat scheduled for 2020-02-19 14:00 UTC. This meeting is held in the #core-editor WordPress Slack channel.

  • WordPress 5.4 Upcoming Release
  • Weekly Priorities
  • Task Coordination
  • Open Floor

If you have anything to share for the Task Coordination section, please leave it as a comment on this post. If you have anything to propose for the agenda or other specific items related to those listed above, please leave a comment below.

#agenda#core-editor#editor-chat

CSS Chat Agenda: 20th February 2020

This is the agenda for the upcoming CSS meeting scheduled for Thursday, 20th February, 9pm UTC.

This meeting will be held in the #core-css channel  in the Making WordPress Slack.

There’s nothing pressing on the agenda for this week, so feel free to add any topics you’d like to discuss in the comments!

Agenda:

  • Open Floor

#agenda, #core-css

XML Sitemaps Kickoff Meeting Announcement

A few weeks ago an update was posted for the XML Sitemaps feature project to give everyone an idea of where it is heading.

Now, we want to gather more contributors around the feature plugin and get your feedback on the project. For this, we’re kicking off regular meetings in the brand new #core-sitemaps Slack channel.

The first meeting will be held on Tuesday, February 18 at 16.00 CET and will serve as an introduction to the project and an opportunity to discuss the next steps. As such, there is currently no formal agenda for this inaugural meeting.

However, if you have anything specific that you’d like to propose being discussed in this meeting, feel free to leave a comment below.

This meeting is held in the #core-sitemaps channel , to join the meeting, you’ll need an account on the Making WordPress Slack.

#feature-plugins, #feature-projects, #seo, #xml-sitemaps

WP Notify meeting update.

Due to technical problems last week, the meeting scheduled for Monday, February 10, 2020 will be happening today Monday, February 17, 2020, 14:00 UTC .

You can view the agenda here.

This meeting is held in the #feature-notifications channel , to join the meeting, you’ll need an account on the Making WordPress Slack.

#feature-notifications

#agenda

CSS Chat Summary: 13 February 2020

I (@isabel_brison) facilitated the meeting based on this agenda.

Full meeting transcript on Slack

First point: how to set standards for using CSS grid in core, especially regarding browser support

I launched the question: why use grid? 

And proposed its main advantage for us is in complex multi-column layouts, in particular if they have dynamically sized columns (such as the columns block).

@laras126 mentioned grid may be more performant in rendering versus flexbox, based on this blog post.

@peterwilsoncc suggested using grid with @supports-based fallbacks, whether using the non-standard IE implementation of grid or otherwise.

I suggested a progressive enhancement approach, assuring basic functionality for IE.

@laras126 pointed out that using the IE implementation of grid is not recommended, referring to this blog post.

@afercia mentioned we could simply wait until WP stops supporting IE, and questioned whether we actually need to use grid. 

I mentioned some complex, buggy flex layouts could be fixed by using grid, but there’s no need to refactor all our layouts.

@peterwilsoncc proposed some parts of the admin could benefit, as grid reduces complexity for responsive layouts.

@afercia showed support for a redesign/refactor of WP admin if implemented in a mobile-first way.

@itsjonq considered that grid makes for cleaner, easier to understand code, so improves maintainability and stability.

Second point: how to approach using CSS variables in core, also regarding browser support

I introduced the topic by sharing the global styles proposal as example of the benefits of variables for theming and user customisation, and lamented the total lack of IE support.

@afercia manifested concern that this discussion may be overly Gutenberg-centric, based on the global styles proposal.

@itsjonq added that the current polyfills for variables don’t work 100% for all cases.

@laras126 suggested leveraging the cascade and Sass variables as fallbacks.

@peterwilsoncc proposed that use of @supports and its JS equivalent could make a progressive enhancement approach easier than with grid, e.g. colour schemes could switch to variables and be available only where supported.

I raised the question of dynamic styles, and suggested variables are extremely useful to use in this case, because they are easier to override than inline styles. However, this approach could only be used as an enhancement, with no IE support.

@peterwilsoncc reminded us that for the front end, IE compatibility is crucial, as ignoring it would force all our users to stop supporting IE themselves. Bearing this in mind, inline styles cannot be fully removed from the front end.

@afercia showed concern that CSS variables have already been introduced in core (on the About page), with no prior discussion.

Third point: should we adopt CSS-in-JS? 

I introduced the topic by pointing to my list of prior experiments and discussions about CSS-in-JS and stating two perceived advantages to it: reducing specificity and making it easier to reuse components anywhere.

@peterwilsoncc advocated for the importance of using a library that allows “easily styling state based styles without a tonne of mucking around with helper classes”, but expressed a preference for libraries that allow for the CSS to be precompiled rather than modifying the styles in the document, such as CSS Modules or CSS Blocks. He added that toggling classnames requires less re-rendering than stylesheet changes.

@laras126 suggested utility classes as an alternative approach to specificity issues and bloated stylesheets.

I observed that we’re not likely see a reduction in specificity until most or all of our CSS is refactored to CSS-in-JS, something very unlikely to happen.

@itsjonq clarified that he proposed CSS-in-JS specifically for wordpress/components because that package has unique style requirements: its components need to work everywhere, without additional styling. 

@afercia mentioned that CSS-in-JS is too coupled with proprietary JS library implementations, so it’s not future-proof enough in terms of conforming to web standards. He also pointed out that these solutions break the cascade in CSS, which is a fundamental aspect of the technology.

@itsjonq mentioned that there are attempts from these libraries to standardize approaches, though the proprietary aspect is indeed a concern. He reminded that we already use Sass, which is also a “non-standard” tool.

I reminded that standards can change in response to proprietary implementations, if they prove popular enough.

At this point, we reached the hour, but the discussion continued.

@peterwilsoncc pointed out the benefit of pre-compiled CSS files for future compatibility: the generated code can still be used if a technology changes.

I asked if it’s possible to precompile CSS-in-JS, to which @itsjonq answered there’s no good solution to do so yet.

@laras126 shared a movement to standardise design tokens that could be incompatible with a CSS-in-JS approach.

@afercia elaborated on his concern that CSS-in-JS breaks the cascade, as each individual element would need to be styled separately.

I suggested that issue can be avoided by using a combination of global and component-specific styles.

@afercia asked where CSS-in-JS can actually be helpful? To which @timothybjacobs replied: being able to reuse the Gutenberg wordpress/components outside of Gutenberg with reliable styling.

@itsjonq also replied that a lot of the internal Gutenberg styles are messy and overly specific, and that it’s difficult to reliably target UI that render at different locations in the DOM tree, e.g. Popovers.

@afercia reminded that specificity in Gutenberg is often because it needs to override wp-admin styles.

@itsjonq pointed out that the low specificity enforcement only works when starting from a clean slate, but there are workarounds available for integrating with legacy code (such as namespacing new styles to bump up specificity if needed). He shared his own helper library for this.

@afercia replied that this would create more specificity bloat, and @itsjonq observed that although that is the case, they would be sure to render correctly, i.e. there would be no clashes between old and new styles.

@laras126 made a helpful summary of needs that CSS-in-JS can help us meet:

  • Enforcing low specificity
  • Scoping styles
  • Bundling CSS with components
  • Enabling developers with varying backgrounds to write CSS safely

and offered to write up some notes about using single-declaration utilities as an alternative .

I also pointed out that CSS-in-JS makes it easier for JS devs, but harder for more UI-focused devs and designers to touch the code.

@laras216 asked if we should make this meeting a regular one, or at least have a follow-up. It was agreed to make it regular, and @noisysocks suggested same time next week.

@laras126 also shared a w3c proposal for selectors to reset specificity.

And that was it for this time!

#core-css-2

WordPress 5.4 introduces apply_shortcodes() as an alias for do_shortcode()

WordPress 5.4 introduces a new function – apply_shortcodes(). It’s an alias for the current do_shortcode() function.

The semantics of do_* implies the function displays the result of the shortcode. But that’s not actually the case. In fact, do_shortcode() needs to be echoed to display its result.

Here is the current implementation:

echo do_shortcode( '[wporg]My Text[/wporg]' );
// Displays the result of the shortcode

Semantically, we should be able to do this:

do_shortcode( '[wporg]My Text[/wporg]' );
// but it doesn’t display anything…

As you may know, do_shortcode() is used in countless plugins and themes. So there is currently no option to deprecate it. But if the community can start building a consensus around the alias, apply_shortcodes(), then deprecation may eventually become a real option in the future.

There is a precedent for making this move. It’s the same process the core team followed with get_permalink() and get_the_permalink().

apply_shortcodes is meant to get better semantics: instead of performing an action and outputting to the current buffer, the idea is to apply filters to the input and return a result. The process is simpler, cleaner and more maintainable – not to mention easier to teach new developers.

apply_shortcodes() can be used the same way do_shortcode() is currently used:

echo apply_shortcodes( '[wporg]My Text[/wporg]' );
// Displays the result of the shortcode

Themes/Plugins authors and WordPress developers are invited to start using apply_shortcodes() instead of do_shortcode().

To be clear, there is no plan for deprecating the former function right now. But the sooner developers can all switch to the much more semantic apply_shortcodes(), the sooner the core team can plan to deprecate the old function. With WordPress 5.4, apply_shortcodes() is now the recommended way to display the result of a shortcode.


For reference, see the related Trac ticket: #37422

Copy review: @marybaum

#5-4, #dev-notes, #shortcodes

An updated Button component in WordPress 5.4

As the @wordpress/components package becomes the vehicle that implements more and more of the WordPress design system, and as that system matures, its components get more consistent and more coherent.

WordPress 5.4 adds a number of changes and enhancements to the Button component.

Button sizes

In keeping with the overall design direction of the project, the button default height is now 36px. So you no longer need to use the previous isLarge prop variation.

The Button still supports the isSmall variation.

import { Button } from '@wordpress/components';

const regularButton = <Button>My Button</Button>;
const smallButton = <Button isSmall>My Button</Button>;

To keep all the button variations consistent, their styles now declare specific heights.

If you’ve been relying on the previous buttons’ dynamic heights to make them adapt to their content, you’ll want to override the new fixed heights. Make sure you add the rule below:

height: auto;

Icon support

In previous versions, the components package offered a Button component for regular buttons and an IconButton for buttons with icons.

WordPress 5.4 merges those components. To show buttons with icons, pass an extra icon prop to the regular Button component. You can also mix text and icons.

import { Button } from '@wordpress/components';

const myIcon = (
  <svg xmlns="http://www.w3.org/2000/svg" viewport="0 0 20 20">
    <path r="M5 4l10 6-10 6V4z" />
  </svg>
);

const SimpleIconButton = <Button icon={ myIcon } label="Button label" />;

const IconAndTextButton = (
  <Button icon={ myIcon }>
    Button Text
  </Button>
);

Note: the IconButton is still available, but it’s officially deprecated.

Classname changes

In previous versions, icon buttons relied internally on the components-icon-button. With the merger of the Button and IconButton components, WordPress removes this class name and replaces it with .components-button.has-icon.

Recommendation: Don’t rely on any internal className a component might use. If you want to target a specific component, prefer adding your own className prop and use that instead.

Going further

Try out the Button component or the other wordpress/components. Check out the components Storybook.

#5-4, #block-editor, #components, #dev-notes