-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Use only one button for Set featured image and image preview. #14415
Use only one button for Set featured image and image preview. #14415
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great on my tests and the changes make sense 👍
title={ postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL } | ||
onSelect={ onUpdateImage } | ||
allowedTypes={ ALLOWED_MEDIA_TYPES } | ||
modalClass={ ! featuredImageId ? 'editor-post-featured-image__media-modal' : 'editor-post-featured-image__media-modal' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both classes are the same -- I think we can just use modalClass="editor-post-featured-image__media-modal".
Thanks @jorgefilipecosta ! Didn't have time to look into the class thing today, sorry. |
Description
Refactors the featured image buttons to avoid a focus loss.
The "Set featured image" and the image preview are both buttons. Actually, they're two
MediaUploadCheck
components: very similar, only the props and children are different.By using only one
MediaUploadCheck
and updating props and children, the reference to the "opener" DOM element is not lost and the Media Modal is able to move focus back properly when it closes.To test:
Fixes #14414