close
Skip to content

Fix[Alt Generation]: Generate button becomes unresponsive after using Next/Previous in media modal#631

Merged
dkotter merged 4 commits into
WordPress:developfrom
yogeshbhutkar:fix-627/alt-text-generation
May 28, 2026
Merged

Fix[Alt Generation]: Generate button becomes unresponsive after using Next/Previous in media modal#631
dkotter merged 4 commits into
WordPress:developfrom
yogeshbhutkar:fix-627/alt-text-generation

Conversation

@yogeshbhutkar

@yogeshbhutkar yogeshbhutkar commented May 28, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #627

Fixes the Alt Text Generation button becoming unresponsive after using Previous/Next inside the media modal.

Why?

The media modal replaces or refreshes the attachment details UI during navigation. The existing initialization only handled the initial modal state, so the Generate/Regenerate button could lose its event binding after moving to another attachment.

How?

Bind to the media edit frame’s refresh event after the edit attachment modal is first opened. This re-initializes the alt text controls when the modal refreshes for Previous/Next navigation, while ensuring the refresh handler is registered only once to avoid duplicate generation requests.

Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5.5
Used for: Initial code skeleton; final implementation was reviewed and edited by me.

Testing Instructions

  1. Go to Media → Library.
  2. Select an image and generate alt text.
  3. Use the modal’s Previous/Next controls to navigate to another image.
  4. Confirm the Generate/Regenerate button still works.
  5. Close and reopen the media modal, then generate alt text again.
  6. In the Network tab, confirm each Generate/Regenerate click sends exactly one request.

Screencasts

Before

before.mov

After

after.mov

Changelog Entry

Fixed - Alt Text Generation button becomes unresponsive after using Next/Previous in the media modal.

Open WordPress Playground Preview

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.45%. Comparing base (77f116e) to head (f93f0e5).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #631   +/-   ##
==========================================
  Coverage      74.45%   74.45%           
  Complexity      1740     1740           
==========================================
  Files             85       85           
  Lines           7521     7521           
==========================================
  Hits            5600     5600           
  Misses          1921     1921           
Flag Coverage Δ
unit 74.45% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yogeshbhutkar yogeshbhutkar changed the title WIP: Fix Alt Generation button becomes unresponsive on media frame refresh [Alt Generation]: Fix alt text generation after media modal navigation May 28, 2026
@yogeshbhutkar yogeshbhutkar changed the title [Alt Generation]: Fix alt text generation after media modal navigation Fix[Alt Generation]: Generate button becomes unresponsive after using Next/Previous in media modal May 28, 2026
@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review May 28, 2026 05:29
@github-actions

Copy link
Copy Markdown

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 props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @kohcsi.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: kohcsi.

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@yogeshbhutkar yogeshbhutkar force-pushed the fix-627/alt-text-generation branch from fb6f249 to 8ddad80 Compare May 28, 2026 05:30
@jeffpaul jeffpaul added this to the 1.1.0 milestone May 28, 2026

@jeffpaul jeffpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected via Playground testing, thanks!

@jeffpaul jeffpaul requested a review from dkotter May 28, 2026 14:08
@dkotter dkotter merged commit b4d6ce3 into WordPress:develop May 28, 2026
25 checks passed
@yogeshbhutkar yogeshbhutkar deleted the fix-627/alt-text-generation branch May 29, 2026 03:16
jorgefilipecosta pushed a commit that referenced this pull request Jun 15, 2026
… Next/Previous in media modal (#631)

Fixed - Alt Text Generation button becomes unresponsive after using Next/Previous in the media modal.

Unlinked contributors: kohcsi.

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
@jeffpaul

Copy link
Copy Markdown
Member

@kohcsi if you're able to confirm your WordPress.org username (and ideally link it with your GitHub account), then I can ensure its properly credited in the AI plugin release (and associated AI Contributor badge)... thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alt Text Generation button becomes unresponsive when navigating between images in Media Library modal

3 participants