Skip to content

Commit

Permalink
Twenty Nineteen: Fixes and improvements.
Browse files Browse the repository at this point in the history
This commit brings over several changes that occurred upstream in the theme’s GitHub repository into core.

- Fix the gallery caption link color. WordPress/twentynineteen#687
- Remove left padding from pullquote blocks. WordPress/twentynineteen#690
- Print `skip-link-focus-fix` inline instead of enqueueing as blocking script. WordPress/twentynineteen#47
- Fix and improve some strings with placeholders. WordPress/twentynineteen#217

Props kjellr, allancole, dimadin, westonruter.

See #45424.
Built from https://develop.svn.wordpress.org/branches/5.0@44196


git-svn-id: http://core.svn.wordpress.org/branches/5.0@44026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
desrosj committed Dec 15, 2018
1 parent d3c1b8f commit 08befd9
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 9 deletions.
Expand Up @@ -51,7 +51,6 @@ protected function html5_comment( $comment, $depth, $args ) {
* fill color to the inner check shape when in circle form.
*/
if ( twentynineteen_is_comment_by_post_author( $comment ) ) {
/* translators: %s: SVG Icon */
printf( '<span class="post-author-badge" aria-hidden="true">%s</span>', twentynineteen_get_icon_svg( 'check', 24 ) );
}

Expand Down Expand Up @@ -110,5 +109,4 @@ protected function html5_comment( $comment, $depth, $args ) {
?>
<?php
}

}
20 changes: 18 additions & 2 deletions wp-content/themes/twentynineteen/functions.php
Expand Up @@ -221,8 +221,6 @@ function twentynineteen_scripts() {

wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' );

wp_enqueue_script( 'twentynineteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

if ( has_nav_menu( 'menu-1' ) ) {
wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '1.0', true );
wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '1.0', true );
Expand All @@ -236,6 +234,24 @@ function twentynineteen_scripts() {
}
add_action( 'wp_enqueue_scripts', 'twentynineteen_scripts' );

/**
* Fix skip link focus in IE11.
*
* This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded.
*
* @link https://git.io/vWdr2
*/
function twentynineteen_skip_link_focus_fix() {
// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
?>
<script>
/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
</script>
<?php
}
add_action( 'wp_print_footer_scripts', 'twentynineteen_skip_link_focus_fix' );

/**
* Enqueue supplemental block editor styles.
*/
Expand Down
6 changes: 3 additions & 3 deletions wp-content/themes/twentynineteen/inc/template-tags.php
Expand Up @@ -40,8 +40,8 @@ function twentynineteen_posted_on() {
*/
function twentynineteen_posted_by() {
printf(
'<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
/* translators: 1: SVG icon. 2: post author, only visible to screen readers. 3: author link. */
'<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
twentynineteen_get_icon_svg( 'person', 16 ),
__( 'Posted by', 'twentynineteen' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
Expand Down Expand Up @@ -85,8 +85,8 @@ function twentynineteen_entry_footer() {
/* translators: used between list items, there is a space after the comma. */
$categories_list = get_the_category_list( __( ', ', 'twentynineteen' ) );
if ( $categories_list ) {
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
printf(
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
'<span class="cat-links">%1$s<span class="screen-reader-text">%2$s</span>%3$s</span>',
twentynineteen_get_icon_svg( 'archive', 16 ),
__( 'Posted in', 'twentynineteen' ),
Expand All @@ -97,8 +97,8 @@ function twentynineteen_entry_footer() {
/* translators: used between list items, there is a space after the comma. */
$tags_list = get_the_tag_list( '', __( ', ', 'twentynineteen' ) );
if ( $tags_list ) {
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
printf(
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
'<span class="tags-links">%1$s<span class="screen-reader-text">%2$s </span>%3$s</span>',
twentynineteen_get_icon_svg( 'tag', 16 ),
__( 'Tags:', 'twentynineteen' ),
Expand Down
2 changes: 2 additions & 0 deletions wp-content/themes/twentynineteen/js/skip-link-focus-fix.js
Expand Up @@ -3,6 +3,8 @@
*
* Helps with accessibility for keyboard only users.
*
* This is the source file for what is minified in the twentynineteen_skip_link_focus_fix() PHP function.
*
* Learn more: https://git.io/vWdr2
*/
( function() {
Expand Down
5 changes: 5 additions & 0 deletions wp-content/themes/twentynineteen/sass/blocks/_blocks.scss
Expand Up @@ -324,6 +324,7 @@
margin-top: calc(4 * #{ $size__spacing-unit});
margin-bottom: calc(4.33 * #{ $size__spacing-unit});
margin-right: 0;
padding-left: 0;
}

p {
Expand Down Expand Up @@ -578,6 +579,10 @@
.blocks-gallery-item:last-child {
margin-bottom: 16px;
}

figcaption a {
color: #fff;
}
}

//! Captions
Expand Down
3 changes: 2 additions & 1 deletion wp-content/themes/twentynineteen/single.php
Expand Up @@ -27,7 +27,8 @@
// Parent post navigation.
the_post_navigation(
array(
'prev_text' => _x( '<span class="meta-nav">Published in</span><br/><span class="post-title">%title</span>', 'Parent post link', 'twentynineteen' ),
/* translators: %s: parent post link */
'prev_text' => sprintf( __( '<span class="meta-nav">Published in</span><span class="post-title">%s</span>', 'twentynineteen' ), '%title' ),
)
);
} elseif ( is_singular( 'post' ) ) {
Expand Down
5 changes: 5 additions & 0 deletions wp-content/themes/twentynineteen/style-rtl.css
Expand Up @@ -3765,6 +3765,7 @@ body.page .main-navigation {
margin-top: calc(4 * 1rem);
margin-bottom: calc(4.33 * 1rem);
margin-left: 0;
padding-right: 0;
}

.entry .entry-content .wp-block-pullquote p {
Expand Down Expand Up @@ -4047,6 +4048,10 @@ body.page .main-navigation {
margin-bottom: 16px;
}

.entry .entry-content .wp-block-gallery figcaption a {
color: #fff;
}

.entry .entry-content .wp-block-audio figcaption,
.entry .entry-content .wp-block-video figcaption,
.entry .entry-content .wp-block-image figcaption,
Expand Down
5 changes: 5 additions & 0 deletions wp-content/themes/twentynineteen/style.css
Expand Up @@ -3777,6 +3777,7 @@ body.page .main-navigation {
margin-top: calc(4 * 1rem);
margin-bottom: calc(4.33 * 1rem);
margin-right: 0;
padding-left: 0;
}

.entry .entry-content .wp-block-pullquote p {
Expand Down Expand Up @@ -4059,6 +4060,10 @@ body.page .main-navigation {
margin-bottom: 16px;
}

.entry .entry-content .wp-block-gallery figcaption a {
color: #fff;
}

.entry .entry-content .wp-block-audio figcaption,
.entry .entry-content .wp-block-video figcaption,
.entry .entry-content .wp-block-image figcaption,
Expand Down
Expand Up @@ -10,6 +10,7 @@
if ( (bool) get_the_author_meta( 'description' ) ) : ?>
<div class="author-bio">
<h2 class="author-title">
<?php /* translators: %s: author name */ ?>
<span class="author-heading"><?php echo esc_html( sprintf( __( 'Published by %s', 'twentynineteen' ), get_the_author() ) ); ?></span>
</h2>
<p class="author-description">
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0.2-alpha-44195';
$wp_version = '5.0.2-alpha-44196';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 08befd9

Please sign in to comment.