diff --git a/wp-content/themes/twentytwenty/.stylelintrc.json b/wp-content/themes/twentytwenty/.stylelintrc.json index fedd7376c7..f88810795c 100644 --- a/wp-content/themes/twentytwenty/.stylelintrc.json +++ b/wp-content/themes/twentytwenty/.stylelintrc.json @@ -1,7 +1,12 @@ { - "extends": "stylelint-config-wordpress", + "extends": [ + "stylelint-config-wordpress" + ], + "plugins": ["stylelint-a11y"], "rules": { "font-family-no-missing-generic-family-keyword": null, - "no-descending-specificity": null + "no-descending-specificity": null, + "a11y/no-outline-none": true, + "a11y/selector-pseudo-class-focus": true } } diff --git a/wp-content/themes/twentytwenty/assets/css/editor-style-block-rtl.css b/wp-content/themes/twentytwenty/assets/css/editor-style-block-rtl.css index 337664dc45..82f17acc90 100644 --- a/wp-content/themes/twentytwenty/assets/css/editor-style-block-rtl.css +++ b/wp-content/themes/twentytwenty/assets/css/editor-style-block-rtl.css @@ -57,14 +57,14 @@ Inter variable font. Usage: font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: normal; - src: url(../fonts/inter/Inter-upright.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-upright-var.woff2) format("woff2"); } @font-face { font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: italic; - src: url(../fonts/inter/Inter-italic.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-italic-var.woff2) format("woff2"); } /* Structure --------------------------------- */ diff --git a/wp-content/themes/twentytwenty/assets/css/editor-style-block.css b/wp-content/themes/twentytwenty/assets/css/editor-style-block.css index 054b1017ad..778ae47c8e 100644 --- a/wp-content/themes/twentytwenty/assets/css/editor-style-block.css +++ b/wp-content/themes/twentytwenty/assets/css/editor-style-block.css @@ -57,14 +57,14 @@ Inter variable font. Usage: font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: normal; - src: url(../fonts/inter/Inter-upright.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-upright-var.woff2) format("woff2"); } @font-face { font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: italic; - src: url(../fonts/inter/Inter-italic.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-italic-var.woff2) format("woff2"); } /* Structure --------------------------------- */ diff --git a/wp-content/themes/twentytwenty/assets/css/editor-style-classic-rtl.css b/wp-content/themes/twentytwenty/assets/css/editor-style-classic-rtl.css index 3f4fb91e0e..fb20e67f5b 100644 --- a/wp-content/themes/twentytwenty/assets/css/editor-style-classic-rtl.css +++ b/wp-content/themes/twentytwenty/assets/css/editor-style-classic-rtl.css @@ -30,14 +30,14 @@ Inter variable font. Usage: font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: normal; - src: url(../fonts/inter/Inter-upright.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-upright-var.woff2) format("woff2"); } @font-face { font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: italic; - src: url(../fonts/inter/Inter-italic.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-italic-var.woff2) format("woff2"); } /* Structure --------------------------------- */ diff --git a/wp-content/themes/twentytwenty/assets/css/editor-style-classic.css b/wp-content/themes/twentytwenty/assets/css/editor-style-classic.css index 6e6f2960b7..1827a866ed 100644 --- a/wp-content/themes/twentytwenty/assets/css/editor-style-classic.css +++ b/wp-content/themes/twentytwenty/assets/css/editor-style-classic.css @@ -30,14 +30,14 @@ Inter variable font. Usage: font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: normal; - src: url(../fonts/inter/Inter-upright.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-upright-var.woff2) format("woff2"); } @font-face { font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: italic; - src: url(../fonts/inter/Inter-italic.var.woff2) format("woff2"); + src: url(../fonts/inter/Inter-italic-var.woff2) format("woff2"); } /* Structure --------------------------------- */ diff --git a/wp-content/themes/twentytwenty/assets/js/index.js b/wp-content/themes/twentytwenty/assets/js/index.js index 1ed91c53f5..f2c68748de 100644 --- a/wp-content/themes/twentytwenty/assets/js/index.js +++ b/wp-content/themes/twentytwenty/assets/js/index.js @@ -92,23 +92,25 @@ twentytwenty.coverModals = { // Handle cover modals when they're toggled onToggle: function() { - document.querySelector( '.cover-modal' ).addEventListener( 'toggled', function( event ) { - var modal, body; + document.querySelectorAll( '.cover-modal' ).forEach( function( element ) { + element.addEventListener( 'toggled', function( event ) { + var modal, body; - modal = event.target; - body = document.body; + modal = event.target; + body = document.body; - if ( modal.classList.contains( 'active' ) ) { - body.classList.add( 'showing-modal' ); - } else { - body.classList.remove( 'showing-modal' ); - body.classList.add( 'hiding-modal' ); + if ( modal.classList.contains( 'active' ) ) { + body.classList.add( 'showing-modal' ); + } else { + body.classList.remove( 'showing-modal' ); + body.classList.add( 'hiding-modal' ); - // Remove the hiding class after a delay, when animations have been run - setTimeout( function() { - body.classList.remove( 'hiding-modal' ); - }, 500 ); - } + // Remove the hiding class after a delay, when animations have been run + setTimeout( function() { + body.classList.remove( 'hiding-modal' ); + }, 500 ); + } + } ); } ); }, @@ -413,7 +415,7 @@ twentytwenty.modalMenu = { init: function() { // If the current menu item is in a sub level, expand all the levels higher up on load this.expandLevel(); - this.goBackToCloseButton(); + this.keepFocusInModal(); }, expandLevel: function() { @@ -433,74 +435,54 @@ twentytwenty.modalMenu = { } ); }, - // If the current menu item is the last one, return to close button when tab - goBackToCloseButton: function() { - document.addEventListener( 'keydown', function( event ) { - var closeMenuButton, mobileMenu, isDesktop, menuLinks, firstLevelmenuLinks, lastMenuLinkToggleButton, lastToogleSubMenuLinkNotOpened, lastMenuLinkHasSubClosedMenu, socialLinks, hasSocialMenu, lastModalMenuItems, focusedElementParentLi, focusedElementIsInsideModal, lastMenuItem, isFirstModalItem, isLastModalItem; + keepFocusInModal: function() { + var _doc = document; - closeMenuButton = document.querySelector( '.toggle.close-nav-toggle' ); - mobileMenu = document.querySelector( '.mobile-menu' ); + _doc.addEventListener( 'keydown', function( event ) { + var clickedEl = twentytwenty.toggles.clickedEl, + toggleTarget, modal, selectors, elements, menuType, bottomMenu, activeEl, lastEl, firstEl, tabKey, shiftKey; - if ( mobileMenu ) { - return false; - } + if ( clickedEl && _doc.body.classList.contains( 'showing-modal' ) ) { + toggleTarget = clickedEl.dataset.toggleTarget; + selectors = 'input, a, button'; + modal = _doc.querySelector( toggleTarget ); - isDesktop = window.getComputedStyle( mobileMenu, null ).getPropertyValue( 'display' ) === 'none'; + elements = modal.querySelectorAll( selectors ); + elements = Array.prototype.slice.call( elements ); - menuLinks = isDesktop ? - document.querySelectorAll( '.menu-modal .expanded-menu .modal-menu li' ) : - document.querySelectorAll( '.menu-modal .mobile-menu .modal-menu li' ); + if ( '.menu-modal' === toggleTarget ) { + menuType = window.matchMedia( '(min-width: 1000px)' ).matches; + menuType = menuType ? '.expanded-menu' : '.mobile-menu'; - firstLevelmenuLinks = isDesktop ? - document.querySelectorAll( '.menu-modal .expanded-menu .modal-menu > li' ) : - document.querySelectorAll( '.menu-modal .mobile-menu .modal-menu > li' ); + elements = elements.filter( function( element ) { + return null !== element.closest( menuType ) && null !== element.offsetParent; + } ); - if ( firstLevelmenuLinks ) { - return false; - } + elements.unshift( _doc.querySelector( '.close-nav-toggle' ) ); - lastMenuLinkToggleButton = firstLevelmenuLinks[firstLevelmenuLinks.length - 1].querySelector( '.sub-menu-toggle' ) || undefined; - lastMenuLinkHasSubClosedMenu = lastMenuLinkToggleButton && ! lastMenuLinkToggleButton.classList.contains( 'active' ); + bottomMenu = _doc.querySelector( '.menu-bottom > nav' ); - lastToogleSubMenuLinkNotOpened = isDesktop ? - document.querySelector( '.menu-modal .expanded-menu .modal-menu .sub-menu .sub-menu-toggle:not(.active)' ) : - document.querySelector( '.menu-modal .mobile-menu .sub-menu .sub-menu-toggle:not(.active)' ); + if ( bottomMenu ) { + bottomMenu.querySelectorAll( selectors ).forEach( function( element ) { + elements.push( element ); + } ); + } + } - socialLinks = document.querySelectorAll( '.menu-modal .social-menu li' ); - hasSocialMenu = document.querySelectorAll( '.menu-modal .social-menu' ).length > 0; - lastModalMenuItems = hasSocialMenu ? socialLinks : menuLinks; - focusedElementParentLi = twentytwentyFindParents( event.target, 'li' ); - focusedElementIsInsideModal = twentytwentyFindParents( event.target, '.menu-modal' ).length > 0; + lastEl = elements[ elements.length - 1 ]; + firstEl = elements[0]; + activeEl = _doc.activeElement; + tabKey = event.keyCode === 9; + shiftKey = event.shiftKey; - lastMenuItem = lastModalMenuItems[lastModalMenuItems.length - 1]; + if ( ! shiftKey && tabKey && lastEl === activeEl ) { + event.preventDefault(); + firstEl.focus(); + } - isFirstModalItem = event.target === closeMenuButton; - - isLastModalItem = focusedElementIsInsideModal && focusedElementParentLi[0] ? - focusedElementParentLi[0].className === lastMenuItem.className : - undefined; - - if ( lastMenuLinkToggleButton && lastMenuLinkHasSubClosedMenu && ! hasSocialMenu ) { // Last 1st level item has submenu and is closed - isLastModalItem = event.target === lastMenuLinkToggleButton; - lastMenuItem = lastMenuLinkToggleButton; - } - if ( lastMenuLinkToggleButton && ! lastMenuLinkHasSubClosedMenu && ! hasSocialMenu ) { // Last 1st level item has submenu is opened - isLastModalItem = event.target === lastToogleSubMenuLinkNotOpened || event.target === menuLinks[menuLinks.length - 1].querySelector( 'a' ); - lastMenuItem = lastToogleSubMenuLinkNotOpened || menuLinks[menuLinks.length - 1].querySelector( 'a' ); - } - - if ( ! event.shiftKey && event.key === 'Tab' && isLastModalItem ) { - // Forward - event.preventDefault(); - closeMenuButton.focus(); - } - if ( event.shiftKey && event.key === 'Tab' && isFirstModalItem ) { - // Backward - event.preventDefault(); - if ( lastMenuItem.querySelector( 'a' ) ) { - lastMenuItem.querySelector( 'a' ).focus(); - } else { - lastMenuItem.focus(); + if ( shiftKey && tabKey && firstEl === activeEl ) { + event.preventDefault(); + lastEl.focus(); } } } ); @@ -645,9 +627,13 @@ twentytwenty.toggles = { // Toggle aria-expanded on the toggle twentytwentyToggleAttribute( toggle, 'aria-expanded', 'true', 'false' ); + if ( self.clickedEl && -1 !== toggle.getAttribute( 'class' ).indexOf( 'close-' ) ) { + twentytwentyToggleAttribute( self.clickedEl, 'aria-expanded', 'true', 'false' ); + } + // Toggle body class if ( toggle.dataset.toggleBodyClass ) { - _doc.querySelector( 'body' ).classList.toggle( toggle.dataset.toggleBodyClass ); + _doc.body.classList.toggle( toggle.dataset.toggleBodyClass ); } // Check whether to set focus @@ -777,7 +763,7 @@ function twentytwentyToggleAttribute( element, attribute, trueVal, falseVal ) { if ( falseVal === undefined ) { falseVal = false; } - if ( element[ attribute ] !== trueVal ) { + if ( element.getAttribute( attribute ) !== trueVal ) { element.setAttribute( attribute, trueVal ); } else { element.setAttribute( attribute, falseVal ); diff --git a/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php b/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php index d87c3f2636..2678f7f4f3 100644 --- a/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php +++ b/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php @@ -26,6 +26,12 @@ if ( ! class_exists( 'TwentyTwenty_Customize' ) ) { $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + /** + * Removes the background image section. + * The theme only supports the background color option. + */ + $wp_customize->remove_section( 'background_image' ); + $wp_customize->selective_refresh->add_partial( 'blogname', array( diff --git a/wp-content/themes/twentytwenty/functions.php b/wp-content/themes/twentytwenty/functions.php index b3a901d17b..23288c25f7 100644 --- a/wp-content/themes/twentytwenty/functions.php +++ b/wp-content/themes/twentytwenty/functions.php @@ -459,7 +459,7 @@ function twentytwenty_block_editor_settings() { array( 'name' => _x( 'Large', 'Name of the large font size in the block editor', 'twentytwenty' ), 'shortName' => _x( 'L', 'Short name of the large font size in the block editor.', 'twentytwenty' ), - 'size' => 24, + 'size' => 26.25, 'slug' => 'large', ), array( @@ -481,20 +481,6 @@ function twentytwenty_block_editor_settings() { add_action( 'after_setup_theme', 'twentytwenty_block_editor_settings' ); -/** - * Read More Link - * Overwrite default (more ...) tag - */ -function twentytwenty_read_more_tag() { - return sprintf( - '%2$s "%3$s"', - esc_url( get_permalink( get_the_ID() ) ), - __( 'Continue reading', 'twentytwenty' ), - esc_html( get_the_title( get_the_ID() ) ) - ); -} -add_filter( 'the_content_more_link', 'twentytwenty_read_more_tag' ); - /** * Enqueues scripts for customizer controls & settings. * @@ -647,7 +633,7 @@ function twentytwenty_get_elements_array() { 'background' => array( '.social-icons a', '#site-footer button:not(.toggle)', '#site-footer .button', '#site-footer .faux-button', '#site-footer .wp-block-button__link', '#site-footer .wp-block-file__button', '#site-footer input[type="button"]', '#site-footer input[type="reset"]', '#site-footer input[type="submit"]' ), ), 'background' => array( - 'color' => array( '.social-icons a', '.overlay-header .header-inner', 'body:not(.overlay-header) .primary-menu ul', '.header-footer-group button', '.header-footer-group .button', '.header-footer-group .faux-button', '.header-footer-group .wp-block-button:not(.is-style-outline) .wp-block-button__link', '.header-footer-group .wp-block-file__button', '.header-footer-group input[type="button"]', '.header-footer-group input[type="reset"]', '.header-footer-group input[type="submit"]' ), + 'color' => array( '.social-icons a', 'body:not(.overlay-header) .primary-menu ul', '.header-footer-group button', '.header-footer-group .button', '.header-footer-group .faux-button', '.header-footer-group .wp-block-button:not(.is-style-outline) .wp-block-button__link', '.header-footer-group .wp-block-file__button', '.header-footer-group input[type="button"]', '.header-footer-group input[type="reset"]', '.header-footer-group input[type="submit"]' ), 'background' => array( '#site-header', '.footer-nav-widgets-wrapper', '#site-footer', '.menu-modal', '.menu-modal-inner', '.search-modal-inner', '.archive-header', '.singular .entry-header', '.singular .featured-media:before', '.wp-block-pullquote:before' ), ), 'text' => array( diff --git a/wp-content/themes/twentytwenty/header.php b/wp-content/themes/twentytwenty/header.php index 467f602baf..d66d08fbb0 100644 --- a/wp-content/themes/twentytwenty/header.php +++ b/wp-content/themes/twentytwenty/header.php @@ -121,38 +121,31 @@ - -
+ diff --git a/wp-content/themes/twentytwenty/style-rtl.css b/wp-content/themes/twentytwenty/style-rtl.css index 080579d48c..9762a8e48d 100644 --- a/wp-content/themes/twentytwenty/style-rtl.css +++ b/wp-content/themes/twentytwenty/style-rtl.css @@ -257,14 +257,16 @@ Inter variable font. Usage: font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: normal; - src: url(./assets/fonts/inter/Inter-upright.var.woff2) format("woff2"); + font-display: swap; + src: url(./assets/fonts/inter/Inter-upright-var.woff2) format("woff2"); } @font-face { font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: italic; - src: url(./assets/fonts/inter/Inter-italic.var.woff2) format("woff2"); + font-display: swap; + src: url(./assets/fonts/inter/Inter-italic-var.woff2) format("woff2"); } @@ -534,11 +536,11 @@ dd + dt { blockquote { border-color: #cd2653; border-style: solid; - border-width: 0 0.2rem 0 0; + border-width: 0 0 0 0.2rem; color: inherit; font-size: 1em; margin: 4rem 0; - padding: 0.5rem 2rem 0.5rem 0; + padding: 0.5rem 0 0.5rem 2rem; } cite { @@ -1560,7 +1562,8 @@ ul.primary-menu { } .primary-menu a:hover, -.primary-menu a:focus { +.primary-menu a:focus, +.primary-menu .current_page_ancestor { text-decoration: underline; } @@ -1666,12 +1669,15 @@ ul.primary-menu { .primary-menu ul ul::after { border-bottom-color: transparent; - border-right-color: #000; + border-left-color: #000; bottom: auto; left: -1.6rem; top: 2rem; } +.rtl .primary-menu ul ul::after { + transform: rotate(-180deg); +} /* -------------------------------------------------------------------------- */ @@ -1800,7 +1806,8 @@ button.close-nav-toggle .toggle-text { .modal-menu a:focus, .modal-menu a:hover, -.modal-menu li.current-menu-item > .ancestor-wrapper > a { +.modal-menu li.current-menu-item > .ancestor-wrapper > a, +.modal-menu li.current_page_ancestor > .ancestor-wrapper > a { text-decoration: underline; } @@ -2613,7 +2620,7 @@ h2.entry-title { /* Block Typography Classes ------------------ */ .has-text-align-left { - text-align: right; + text-align: left; } .has-text-align-center { @@ -3171,8 +3178,8 @@ hr.wp-block-separator { } .wp-block-quote[style="text-align:right"] { - border-width: 0 0 0 0.2rem; - padding: 0 0 0 2rem; + border-width: 0 0.2rem 0 0; + padding: 0 2rem 0 0; } /* STYLE: LARGE */ @@ -4012,7 +4019,7 @@ div.comment:first-of-type { /* Widget: RSS ------------------------------- */ -.widget_rss a.rsswidget:first-of-type { +.widget_rss .widget-title a.rsswidget:first-of-type { display: none; } @@ -4992,6 +4999,14 @@ a.to-the-top > * { margin-top: 4rem; } + .alignleft { + margin: 0.3rem 0 2rem 2rem; + } + + .alignright { + margin: 0.3rem 2rem 2rem 0; + } + .alignwide, .alignfull { margin-bottom: 6rem; diff --git a/wp-content/themes/twentytwenty/style.css b/wp-content/themes/twentytwenty/style.css index a9793258a6..75d13eb91a 100644 --- a/wp-content/themes/twentytwenty/style.css +++ b/wp-content/themes/twentytwenty/style.css @@ -257,14 +257,16 @@ Inter variable font. Usage: font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: normal; - src: url(./assets/fonts/inter/Inter-upright.var.woff2) format("woff2"); + font-display: swap; + src: url(./assets/fonts/inter/Inter-upright-var.woff2) format("woff2"); } @font-face { font-family: "Inter var"; font-weight: 100 900; /* stylelint-disable-line font-weight-notation */ font-style: italic; - src: url(./assets/fonts/inter/Inter-italic.var.woff2) format("woff2"); + font-display: swap; + src: url(./assets/fonts/inter/Inter-italic-var.woff2) format("woff2"); } @@ -534,10 +536,14 @@ dd + dt { blockquote { border-color: #cd2653; border-style: solid; + + /*rtl:ignore*/ border-width: 0 0 0 0.2rem; color: inherit; font-size: 1em; margin: 4rem 0; + + /*rtl:ignore*/ padding: 0.5rem 0 0.5rem 2rem; } @@ -1562,7 +1568,8 @@ ul.primary-menu { } .primary-menu a:hover, -.primary-menu a:focus { +.primary-menu a:focus, +.primary-menu .current_page_ancestor { text-decoration: underline; } @@ -1668,12 +1675,17 @@ ul.primary-menu { .primary-menu ul ul::after { border-bottom-color: transparent; + + /*rtl:ignore*/ border-left-color: #000; bottom: auto; right: -1.6rem; top: 2rem; } +.rtl .primary-menu ul ul::after { + transform: rotate(180deg); +} /* -------------------------------------------------------------------------- */ @@ -1802,7 +1814,8 @@ button.close-nav-toggle .toggle-text { .modal-menu a:focus, .modal-menu a:hover, -.modal-menu li.current-menu-item > .ancestor-wrapper > a { +.modal-menu li.current-menu-item > .ancestor-wrapper > a, +.modal-menu li.current_page_ancestor > .ancestor-wrapper > a { text-decoration: underline; } @@ -2615,6 +2628,8 @@ h2.entry-title { /* Block Typography Classes ------------------ */ .has-text-align-left { + + /*rtl:ignore*/ text-align: left; } @@ -3173,8 +3188,12 @@ hr.wp-block-separator { } .wp-block-quote[style="text-align:right"] { + + /*rtl:begin:ignore*/ border-width: 0 0.2rem 0 0; padding: 0 2rem 0 0; + + /*rtl:end:ignore*/ } /* STYLE: LARGE */ @@ -4018,7 +4037,7 @@ div.comment:first-of-type { /* Widget: RSS ------------------------------- */ -.widget_rss a.rsswidget:first-of-type { +.widget_rss .widget-title a.rsswidget:first-of-type { display: none; } @@ -5006,6 +5025,14 @@ a.to-the-top > * { margin-top: 4rem; } + .alignleft { + margin: 0.3rem 2rem 2rem 0; + } + + .alignright { + margin: 0.3rem 0 2rem 2rem; + } + .alignwide, .alignfull { margin-bottom: 6rem; diff --git a/wp-content/themes/twentytwenty/template-parts/content-cover.php b/wp-content/themes/twentytwenty/template-parts/content-cover.php index 74a8a334f5..2080c63439 100644 --- a/wp-content/themes/twentytwenty/template-parts/content-cover.php +++ b/wp-content/themes/twentytwenty/template-parts/content-cover.php @@ -166,7 +166,7 @@ * Output comments wrapper if it's a post, or if comments are open, * or if there's a comment number – and check for password. * */ - if ( ( 'post' === $post->post_type || comments_open() || get_comments_number() ) && ! post_password_required() ) { + if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) { ?>