-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Allow editing of image block alt and title attributes in content only mode #58998
Allow editing of image block alt and title attributes in content only mode #58998
Conversation
Size Change: +416 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in 3d24de9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7897813865
|
This tested well for me. The image component is already quite large though so I wonder if it would be better to extract this to a separate |
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. |
I thought about it. I wonder if it might be an option to move all the controls into one edit: Looked into it, it ends up being quite a bit change, so might be best for after 6.5 is shipped. |
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.
Tested well for me. It would be good to move the block controls out of the main component, but I agree that is a post 6.5 job.
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.
Thanks, I'll follow up on this with a PR for the components package. |
Long term I'd like to look at re-thinking the idea that you can't select child blocks and see their own inspector when inside a content only block as we run into editing inconsistencies like this. We can also look at surfacing overrideable properties within the parent inspector much like Figma. For now, since this is an accessibility concern and only applies to contentOnly blocks, I think it would be fine to ship the approach implemented here. Keen to here @jameskoster , @richtabor opinions on this though. |
* trunk: (78 commits) Components: Use `Element.scrollIntoView()` instead of `dom-scroll-into-view` (#59085) DataViews: Correctly display featured image that don't have image sizes (#59111) Elements: Fix block instance element styles for links applying to buttons (#59114) Allow editing of image block alt and title attributes in content only mode (#58998) Add toggle for grid types and stabilise Grid block variation. (#59051) Global Styles: fix console error in block preview (#59112) Navigation: Avoid using embedded records from fallback API (#59076) Refactor responsive logic for grid column spans. (#59057) Editor: Unify Mode Switcher component between post and site editor (#59100) Move StopEditingAsBlocksOnOutsideSelect to Root (#58412) Fix logic error in #58951 (#59101) Block-editor: Auto-register block commands (#59079) Fix small typo in rich text reference guide (#59089) Components: Add lint rules for theme color CSS var usage (#59022) Enter editing mode via Enter or Spacebar (#58795) Updating Storybook to v7.6.15 (latest) (#59074) CustomSelectControl (v1 & v2): Fix errors in unit test setup (#59038) Add stylelint rule to prevent theme CSS vars outside of wp-components (#59020) ColorPicker: Style without accessing InputControl internals (#59069) Pattern block: batch replacing actions (#59075) ...
… mode (#58998) * Add content only controls for alt and title to image block toolbar * Switch to plain `Dropdown` component to ensure correct semantics inside popover * Iterate on copy and translator comment * Iterate again Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: glendaviesnz <glendaviesnz@git.wordpress.org> Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: SaxonF <saxonafletcher@git.wordpress.org>
I just cherry-picked this PR to the cherry-pick-beta-2 branch to get it included in the next release: 97eb1e1 |
… mode (#58998) * Add content only controls for alt and title to image block toolbar * Switch to plain `Dropdown` component to ensure correct semantics inside popover * Iterate on copy and translator comment * Iterate again Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: glendaviesnz <glendaviesnz@git.wordpress.org> Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: SaxonF <saxonafletcher@git.wordpress.org>
What?
Part of #53705
One of the challenges of editing a block in
contentOnly
mode is that the entire block inspector is unavailable. The mode has an assumption that there are no 'content' controls within the block inspector.For the image block there are some content controls, 'Title' and 'Alternative text'. That they're unavailable has a direct impact on pattern overrides, as it uses contentOnly mode.
How?
For this PR, I've added the controls to the block toolbar, but only when contentOnly mode is active:
When the image block isn't in content only mode they appear back in the inspector as normal.
Testing Instructions