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

  1. Install Focal Point (Varbase has it) and use its widget on the image media type.
  2. Generate an image in the Media Library or on the Add media page.
  3. 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.

Generated image in the Media Library with the Focal Point crosshair in the centre and the Focal point field hidden

API changes

  • None.

Data model changes

  • None.

Release notes snippet

  • Focal Point works on generated images.
CommentFileSizeAuthor
#3 focal-point-fixed.png152.88 KBrajab natshah

Issue fork ai_media-3633891

Command icon 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

rajab natshah created an issue. See original summary.

rajab natshah’s picture

StatusFileSize
new152.88 KB

Merge 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.

Generated image in the Media Library with the Focal Point crosshair in the centre and the Focal point field hidden

rajab natshah’s picture

Issue summary: View changes

rajab natshah’s picture

Status: Active » Fixed
Issue tags: +ai_media-1.0.0-beta1

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.