Skip to content

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

Description

@kohcsi

Description

When opening an image in the Media Library modal view, the "Generate Alt Text" button works correctly for the first image. However, when navigating to another image using the arrow navigation within the same modal, the "Generate" button becomes unresponsive — clicking it produces no result, no loading state, and no error message.

The only workaround is to close the modal entirely and re-open the next image individually, which makes processing multiple images very tedious.

Expected behavior: The "Generate Alt Text" button should work consistently for every image when navigating between them within the modal, without requiring the modal to be closed and reopened.

Step-by-step reproduction instructions

  1. Go to Media Library (wp-admin → Media)
  2. Click on any image to open the modal view (attachment details)
  3. Click the "Generate" button next to "Alt Text" — it works correctly and generates alt text
  4. Use the right arrow at the top of the modal to navigate to the next image
  5. Try clicking the "Generate" button on the new image
  6. Nothing happens — the button does not trigger any action
  7. To make it work again, the modal must be closed and the image opened individually

Screenshots, screen recording, code snippet

Image

Environment info

AI (1.0.0) — WordPress.org Contributors
AI Provider for Anthropic (1.0.3) — WordPress AI Team

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except the AI plugin.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] BugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions