Site Logo: Prevent focus loss when updating media from the sidebar#68621
Conversation
| renderToggle={ ( props ) => ( | ||
| <Button { ...props } __next40pxDefaultSize> | ||
| { temporaryURL ? ( | ||
| <Spinner /> | ||
| ) : ( | ||
| props.children | ||
| ) } | ||
| </Button> |
There was a problem hiding this comment.
Fixes spacing inconsistency with the button. See #68084.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| slug: logoSlug, | ||
| media_details: logoMediaDetails, | ||
| } = mediaItemData; | ||
| } = media ?? {}; |
There was a problem hiding this comment.
The media can be null, where the default parameter isn't used and triggers an error when deconstructing. Using fallback here prevents that.
| onSelect: onSelectLogo, | ||
| onError: onUploadError, | ||
| onRemoveLogo, | ||
| onReset: onRemoveLogo, |
There was a problem hiding this comment.
Just mapping callback to support prop.
|
Size Change: -183 B (-0.01%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
| mediaItemData={ mediaItemData } | ||
| /> | ||
| } | ||
| popoverProps={ {} } |
There was a problem hiding this comment.
This prop was doing nothing. The popoverProps is undefined by default.
|
Thanks for working on this @Mamaduka I cnn confirm the focus loss no longer occurs. To my understanding this also changes the UI, as in: previously the button opened the media modal dialog directly, and now it opens the dropdown with media modal / upload choices. Is that correct? |
Yes, there's a small change to UI/UX, making it more consistent with similar patterns in the editor. For example, the background image control, which can be enabled via block supports. The feature can be tested via Group block. Screenshot |
|
I'm all for consistency, just wanted to illustrate the UI change for history. |
Thanks, @afercia! |
…ordPress#68621) Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>
This comment was marked as off-topic.
This comment was marked as off-topic.
|
Sorry, I seem to have posted this comment here by mistake. I meant to post this comment in #69813. |
…ordPress#68621) Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: afercia <afercia@git.wordpress.org>


What?
PR fixes a focus loss bug when media is selected or reset via the sidebar's media panel. I've also simplified the media control composition; it now only uses the
MediaReplaceFlowcomponent.Why?
Improves accessibility of the component.
Testing Instructions
Testing Instructions for Keyboard
Same.
Screenshots or screencast
CleanShot.2025-01-13.at.09.03.26.mp4