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 modal: Try to improve checkbox labelling #58339

Merged
merged 13 commits into from
Feb 2, 2024
Prev Previous commit
Next Next commit
Make FontDemo clickable
  • Loading branch information
mikachan committed Jan 26, 2024
commit 5fe861b5959f4983cd69e1d525bbb2aa1d58b2c1
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ function CollectionFontVariant( {
fontFace={ face }
text={ displayName }
checkboxId={ checkboxId }
onClick={ handleToggleActivation }
/>
</Flex>
</div>
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ function FontFaceDemo( {
fontFace,
text,
checkboxId,
onClick,
style = {},
} ) {
const ref = useRef( null );
@@ -49,6 +50,9 @@ function FontFaceDemo( {
height: '23px',
width: 'auto',
};
const containerStyle = {
cursor: 'pointer',
};

useEffect( () => {
const observer = new window.IntersectionObserver( ( [ entry ] ) => {
@@ -71,7 +75,15 @@ function FontFaceDemo( {
}, [ fontFace, isIntersecting, loadFontFaceAsset, isPreviewImage ] );

return (
<div ref={ ref } id={ checkboxId }>
<div
ref={ ref }
id={ checkboxId }
onClick={ onClick }
onKeyDown={ onClick }
tabIndex={ -1 }
role="button"
style={ containerStyle }
>
{ isPreviewImage ? (
<img
src={ previewUrl }
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ function LibraryFontVariant( { face, font } ) {
fontFace={ face }
text={ displayName }
checkboxId={ checkboxId }
onClick={ handleToggleActivation }
/>
</Flex>
</div>