Problem/Motivation
On a site with the Focal Point module, a generated image shows the focal point crosshair in the top left corner of the preview and the "Focal point" text field under it, instead of the crosshair in the centre and the field hidden. Dragging the crosshair does nothing.
The generator swaps the form with HTMX. The first result is the first time the image widget is on the page, so the swap brings Focal Point's script. Core's HTMX integration attaches behaviors to the swapped markup before that new script has loaded, so focalPointIndicator never runs. Any other widget whose script arrives with the result has the same problem.
Steps to reproduce
- Install Focal Point (Varbase has it) and use its widget on the image media type.
- Generate an image in the Media Library or on the Add media page.
- The crosshair is in the top left and the Focal point field shows.
Proposed resolution
- When a script that a generator swap added has loaded, attach behaviors to the AI Media form again (
once()keeps each behavior to one run). - Nothing changes on a site without Focal Point.
AI-Generated: Yes
Remaining tasks
- ✅ File an issue
- ❌ Addition/Change/Update/Fix
- ❌ Testing to ensure no regression
- ❌ Automated unit/functional testing coverage
- ➖ Developer Documentation support
- ➖ User Guide Documentation support
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ❌ Update Release Notes
- ❌ Release
User interface changes
- With Focal Point, the crosshair of a generated image starts in the centre and can be moved.

API changes
- None.
Data model changes
- None.
Release notes snippet
- Focal Point works on generated images.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | focal-point-fixed.png | 152.88 KB | rajab natshah |
Issue fork ai_media-3633891
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rajab natshahMerge request: !33
With the fix, on a Varbase 11 site with Focal Point (Gin): the crosshair of a generated image starts in the centre and the Focal point field is hidden.
Comment #4
rajab natshahComment #6
rajab natshah✅ Released ai_media-1.0.0-beta1