Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Library: buttons position and accessibility #58212

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ function CollectionFontVariant( {
className="font-library-modal__library-font-variant"
htmlFor={ checkboxId }
>
<Flex justify="space-between" align="center" gap="1rem">
<FontFaceDemo fontFace={ face } text={ displayName } />
<Flex justify="flex-start" align="center" gap="1rem">
<CheckboxControl
checked={ selected }
onChange={ handleToggleActivation }
__nextHasNoMarginBottom={ true }
id={ checkboxId }
label={ false }
/>
<FontFaceDemo fontFace={ face } text={ displayName } />
</Flex>
</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR: it's not okay to associate labels and form controls with both a for attribute and by wrapping the form control within the label element. I do realize the intent is to make the whole row clickable but this is not okay.
I'm surprised the component allows to set the label prop to false.
Also, we do have reusable components for good reasons. One of them is to make sure they're properly labeled. Hardcoding a <label> element around the checkbox component that is supposed to internally handle its label defeats the purpose of having reusable components.

);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,15 @@ function Footer( { shouldDisplayDeleteButton, handleUninstallClick } ) {
const { saveFontFamilies, fontFamiliesHasChanges, isInstalling } =
useContext( FontLibraryContext );
return (
<HStack justify="space-between">
<HStack justify="flex-end">
{ isInstalling && <ProgressBar /> }
<div>
{ shouldDisplayDeleteButton && (
<Button variant="tertiary" onClick={ handleUninstallClick }>
<Button
isDestructive
variant="tertiary"
onClick={ handleUninstallClick }
>
{ __( 'Delete' ) }
</Button>
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ function LibraryFontVariant( { face, font } ) {
className="font-library-modal__library-font-variant"
htmlFor={ checkboxId }
>
<Flex justify="space-between" align="center" gap="1rem">
<FontFaceDemo fontFace={ face } text={ displayName } />
<Flex justify="flex-start" align="center" gap="1rem">
<CheckboxControl
checked={ isIstalled }
onChange={ handleToggleActivation }
__nextHasNoMarginBottom={ true }
id={ checkboxId }
label={ false }
/>
<FontFaceDemo fontFace={ face } text={ displayName } />
</Flex>
</label>
);
Expand Down
Loading