-
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
Format Library: Add alt edit field to inline image #64124
Conversation
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. |
Size Change: +483 B (+0.03%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
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.
This could use some style improvements. But whether they happen here or as a followup, that can be decided separately.
Mainly, the input sizes, spacings, could use some tweaks. The modal shows a 12px gap between last input, and the confirm button:
I think that should actually be 16, but that's separate. But that same gap should also be the gap between the width control, and the alt text control, right now they're very close together:
Question: should the same help text be present for this alt-text field?
Nice work.
value={ alt } | ||
onChange={ ( newAlt ) => { | ||
setAlt( newAlt ); | ||
setHasChanged( true ); |
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.
Why is this needed? Can't we compare the current state?
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.
I was worried that the popover would be too big, but I gave it a try. What do you think? Update:
Changed the gap to 16px. |
Flaky tests detected in 7e17619. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10177667547
|
If it becomes too big, maybe there should be a tab in the inspector for inline content. I think @dmsnell was also looking for that for Bits. :) |
{ __( 'Apply' ) } | ||
</Button> | ||
</HStack> | ||
</VStack> |
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.
Looking at this deeper, why do we even have an apply button here? The image block does not have this either, it just updates right away.
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.
Even in trunk, it won't update unless you explicitly submit the form or press the apply icon button. If we update it immediately, I think the popover will rattle 😅
2b809508a0a1330326ffa2cbe00a3f7c.mp4
@jasmussen Please let us know if there is anything we can improve further in terms of design in this PR 🙏 Below are the latest screenshots: |
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.
@richtabor Thanks for the update! |
Fixes #63323
Related to #28813
What?
This PR makes it possible to change the alt text in the inline image popover.
Why?
If the media already has alt text set, the alt attribute will be applied to the inserted inline image. However, if you want to change the alt attribute, you have no choice but to change the alt of the original media and then reinsert it, or change the value directly via the code editor.
How?
Add a text area to the popover to change the alt text.
Testing Instructions
Testing Instructions for Keyboard
You should be able to change the alt text using just the keyboard.
Screenshots or screencast
f60c149851518f28ed68ff4aa7087883.mp4