Repository navigation
Alt Text Generation: Show the Generate button in the Media Editor route and modal on Gutenberg 23.3+ - #1433
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1433 +/- ##
=============================================
- Coverage 85.59% 85.53% -0.06%
- Complexity 5091 5095 +4
=============================================
Files 193 193
Lines 18425 18443 +18
=============================================
+ Hits 15770 15775 +5
- Misses 2655 2668 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a3a82f1 to
d9a23e8
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
10efdd8 to
eb71c1e
Compare
What, Why, and How?
Closes #1432
Restores the "Generate Alt Text" button in Gutenberg's Media Editor, in both the modal and the route. It also adds
accessibleWhenDisabledto the button.The legacy script overrides core's
alt_textfield 100 ms after detecting the modal or route, but core's fields replace it. Since Gutenberg 23.3, the modal registers its fields only once it opens, so core's registration finishes after ours. The route never sets upcore/editor, so the script's route detection never fires.On Gutenberg 24.3+, where
wp_update_entity_fields()exists, theEditpart ofalt_textis handed to a new@ai/alt-text-fieldscript module that rendersMediaEditorAltTextControl. This is similar to how the excerpt generation experiment handles. On older versions, the legacy script now registers its field from thecore.registerPostTypeSchemaaction, which core fires right after registering its own fields. The timer and store subscribers are removed as they're no longer needed.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Opus 5.5
Used for: Investigating Gutenberg source and history, and drafting the legacy-path fix and this description; reviewed and tested by me.
Testing Instructions
Screencast
fix.mov
Changelog Entry