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.

git-svn-id: https://develop.svn.wordpress.org/branches/5.0@44196 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Dec 14, 2018
1 parent afa8ba3 commit 6d78174
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 8 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. * fill color to the inner check shape when in circle form.
*/ */
if ( twentynineteen_is_comment_by_post_author( $comment ) ) { 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 ) ); 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 <?php
} }

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


wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' ); 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' ) ) { 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-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 ); 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' ); 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. * Enqueue supplemental block editor styles.
*/ */
Expand Down
6 changes: 3 additions & 3 deletions src/wp-content/themes/twentynineteen/inc/template-tags.php
Expand Up @@ -40,8 +40,8 @@ function twentynineteen_posted_on() {
*/ */
function twentynineteen_posted_by() { function twentynineteen_posted_by() {
printf( 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. */ /* 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 ), twentynineteen_get_icon_svg( 'person', 16 ),
__( 'Posted by', 'twentynineteen' ), __( 'Posted by', 'twentynineteen' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), 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. */ /* translators: used between list items, there is a space after the comma. */
$categories_list = get_the_category_list( __( ', ', 'twentynineteen' ) ); $categories_list = get_the_category_list( __( ', ', 'twentynineteen' ) );
if ( $categories_list ) { if ( $categories_list ) {
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
printf( 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>', '<span class="cat-links">%1$s<span class="screen-reader-text">%2$s</span>%3$s</span>',
twentynineteen_get_icon_svg( 'archive', 16 ), twentynineteen_get_icon_svg( 'archive', 16 ),
__( 'Posted in', 'twentynineteen' ), __( '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. */ /* translators: used between list items, there is a space after the comma. */
$tags_list = get_the_tag_list( '', __( ', ', 'twentynineteen' ) ); $tags_list = get_the_tag_list( '', __( ', ', 'twentynineteen' ) );
if ( $tags_list ) { if ( $tags_list ) {
/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
printf( 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>', '<span class="tags-links">%1$s<span class="screen-reader-text">%2$s </span>%3$s</span>',
twentynineteen_get_icon_svg( 'tag', 16 ), twentynineteen_get_icon_svg( 'tag', 16 ),
__( 'Tags:', 'twentynineteen' ), __( 'Tags:', 'twentynineteen' ),
Expand Down
Expand Up @@ -3,6 +3,8 @@
* *
* Helps with accessibility for keyboard only users. * 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 * Learn more: https://git.io/vWdr2
*/ */
( function() { ( function() {
Expand Down
5 changes: 5 additions & 0 deletions src/wp-content/themes/twentynineteen/sass/blocks/_blocks.scss
Expand Up @@ -324,6 +324,7 @@
margin-top: calc(4 * #{ $size__spacing-unit}); margin-top: calc(4 * #{ $size__spacing-unit});
margin-bottom: calc(4.33 * #{ $size__spacing-unit}); margin-bottom: calc(4.33 * #{ $size__spacing-unit});
margin-right: 0; margin-right: 0;
padding-left: 0;
} }


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

figcaption a {
color: #fff;
}
} }


//! Captions //! Captions
Expand Down
3 changes: 2 additions & 1 deletion src/wp-content/themes/twentynineteen/single.php
Expand Up @@ -27,7 +27,8 @@
// Parent post navigation. // Parent post navigation.
the_post_navigation( the_post_navigation(
array( 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' ) ) { } elseif ( is_singular( 'post' ) ) {
Expand Down
5 changes: 5 additions & 0 deletions src/wp-content/themes/twentynineteen/style-rtl.css
Expand Up @@ -3765,6 +3765,7 @@ body.page .main-navigation {
margin-top: calc(4 * 1rem); margin-top: calc(4 * 1rem);
margin-bottom: calc(4.33 * 1rem); margin-bottom: calc(4.33 * 1rem);
margin-left: 0; margin-left: 0;
padding-right: 0;
} }


.entry .entry-content .wp-block-pullquote p { .entry .entry-content .wp-block-pullquote p {
Expand Down Expand Up @@ -4047,6 +4048,10 @@ body.page .main-navigation {
margin-bottom: 16px; 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-audio figcaption,
.entry .entry-content .wp-block-video figcaption, .entry .entry-content .wp-block-video figcaption,
.entry .entry-content .wp-block-image figcaption, .entry .entry-content .wp-block-image figcaption,
Expand Down
5 changes: 5 additions & 0 deletions src/wp-content/themes/twentynineteen/style.css
Expand Up @@ -3777,6 +3777,7 @@ body.page .main-navigation {
margin-top: calc(4 * 1rem); margin-top: calc(4 * 1rem);
margin-bottom: calc(4.33 * 1rem); margin-bottom: calc(4.33 * 1rem);
margin-right: 0; margin-right: 0;
padding-left: 0;
} }


.entry .entry-content .wp-block-pullquote p { .entry .entry-content .wp-block-pullquote p {
Expand Down Expand Up @@ -4059,6 +4060,10 @@ body.page .main-navigation {
margin-bottom: 16px; 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-audio figcaption,
.entry .entry-content .wp-block-video figcaption, .entry .entry-content .wp-block-video figcaption,
.entry .entry-content .wp-block-image figcaption, .entry .entry-content .wp-block-image figcaption,
Expand Down
Expand Up @@ -10,6 +10,7 @@
if ( (bool) get_the_author_meta( 'description' ) ) : ?> if ( (bool) get_the_author_meta( 'description' ) ) : ?>
<div class="author-bio"> <div class="author-bio">
<h2 class="author-title"> <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> <span class="author-heading"><?php echo esc_html( sprintf( __( 'Published by %s', 'twentynineteen' ), get_the_author() ) ); ?></span>
</h2> </h2>
<p class="author-description"> <p class="author-description">
Expand Down

0 comments on commit 6d78174

Please sign in to comment.