diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js index 6236ea8fe3f246..9c8b274abc4b27 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js @@ -307,17 +307,29 @@ function FontCollection( { slug } ) { ) } { ! renderConfirmDialog && ! selectedFont && ( -
+ /* + * Disable reason: The `list` ARIA role is redundant but + * Safari+VoiceOver won't announce the list otherwise. + */ + /* eslint-disable jsx-a11y/no-redundant-roles */ +
+ + /* eslint-enable jsx-a11y/no-redundant-roles */ ) } ); diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js index 99c99e44a43afc..9ccbd62dc0d356 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js @@ -5,12 +5,11 @@ import { __ } from '@wordpress/i18n'; import { useContext, useEffect, useState } from '@wordpress/element'; import { privateApis as componentsPrivateApis, - __experimentalHStack as HStack, - __experimentalSpacer as Spacer, - __experimentalText as Text, Button, Spinner, - FlexItem, + __experimentalHStack as HStack, + __experimentalVStack as VStack, + __experimentalSpacer as Spacer, } from '@wordpress/components'; /** @@ -114,47 +113,72 @@ function InstalledFonts() { { ! libraryFontSelected && ( <> - { isResolvingLibrary && ( - - - - - - ) } - { baseCustomFonts.length > 0 && ( - <> - { baseCustomFonts.map( ( font ) => ( - { - handleSelectFont( font ); - } } - /> - ) ) } - - - ) } - - { baseThemeFonts.length > 0 && ( - <> - - { __( 'Theme Fonts' ) } - - - - { baseThemeFonts.map( ( font ) => ( - { - handleSelectFont( font ); - } } - /> - ) ) } - - ) } - + + { isResolvingLibrary && } + { baseCustomFonts.length > 0 && ( + +

+ { __( 'User Fonts' ) } +

+ { /* + * Disable reason: The `list` ARIA role is redundant but + * Safari+VoiceOver won't announce the list otherwise. + */ + /* eslint-disable jsx-a11y/no-redundant-roles */ } +
    + { baseCustomFonts.map( ( font ) => ( +
  • + { + handleSelectFont( font ); + } } + /> +
  • + ) ) } +
+ { /* eslint-enable jsx-a11y/no-redundant-roles */ } +
+ ) } + { baseThemeFonts.length > 0 && ( + +

+ { __( 'Theme Fonts' ) } +

+ { /* + * Disable reason: The `list` ARIA role is redundant but + * Safari+VoiceOver won't announce the list otherwise. + */ + /* eslint-disable jsx-a11y/no-redundant-roles */ } +
    + { baseThemeFonts.map( ( font ) => ( +
  • + { + handleSelectFont( font ); + } } + /> +
  • + ) ) } +
+ { /* eslint-enable jsx-a11y/no-redundant-roles */ } +
+ ) } +
+ ) } diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/style.scss b/packages/edit-site/src/components/global-styles/font-library-modal/style.scss index 544e3ed63c9883..453dfab0bc2c14 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/style.scss +++ b/packages/edit-site/src/components/global-styles/font-library-modal/style.scss @@ -16,12 +16,6 @@ .components-modal__content { padding-top: 0; } - - .font-library-modal__subtitle { - text-transform: uppercase; - font-weight: 500; - font-size: 11px; - } } .font-library-modal__tabpanel-layout { @@ -40,12 +34,29 @@ margin-bottom: 0; } +.font-library-modal__fonts-title { + text-transform: uppercase; + font-size: 11px; + font-weight: 600; + margin-top: 0; + margin-bottom: 0; +} + +.font-library-modal__fonts-list { + margin-top: 0; + margin-bottom: 0; +} + +.font-library-modal__fonts-list-item { + margin-top: -1px; /* To collapse the margin with the previous element */ + margin-bottom: 0; +} + .font-library-modal__font-card { border: 1px solid $gray-200; width: 100%; height: auto; padding: $grid-unit-20; - margin-top: -1px; /* To collapse the margin with the previous element */ .font-library-modal__font-card__name { font-weight: bold; diff --git a/test/e2e/specs/site-editor/font-library.spec.js b/test/e2e/specs/site-editor/font-library.spec.js index 8bc7cfb17ea629..73aac85cdff288 100644 --- a/test/e2e/specs/site-editor/font-library.spec.js +++ b/test/e2e/specs/site-editor/font-library.spec.js @@ -61,7 +61,7 @@ test.describe( 'Font Library', () => { .click(); await expect( page.getByRole( 'dialog' ) ).toBeVisible(); await expect( - page.getByRole( 'heading', { name: 'Fonts' } ) + page.getByRole( 'heading', { name: 'Fonts', exact: true } ) ).toBeVisible(); } );