Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image: The lightbox behavior not applied when the image is linked #51127

Closed
gziolo opened this issue May 31, 2023 · 2 comments · Fixed by #51180
Closed

Image: The lightbox behavior not applied when the image is linked #51127

gziolo opened this issue May 31, 2023 · 2 comments · Fixed by #51180
Assignees
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended

Comments

@gziolo
Copy link
Member

gziolo commented May 31, 2023

Description

I might be a design decision never to display the lightbox when the image from the Image block is wrapped with a link. However, at the moment, the option is still visible in the editor's UI even when it won't be used on the frontend.

Step-by-step reproduction instructions

  1. Activate the experiment that enables Interactivity API and Behaviors.
  2. Go to the post editor.
  3. Insert an image in the post.
  4. In the advanced settings for the Image block, activate the lightbox behavior.
  5. From the block toolbar select Insert link option.
  6. Choose any option that wraps the image with a link, for example: Media File.
  7. Publish the post.
  8. Navigate to the post on the front end.
  9. Click on the image and observe that the link opens a new page, and the lightbox never shows up.

Screenshots, screen recording, code snippet

View in the editor:

Screenshot 2023-05-31 at 11 56 29

View on the frontend:

Screenshot 2023-05-31 at 11 57 49

Environment info

  • WordPress 6.2, Gutenberg latest (trunk)

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

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@gziolo gziolo added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block labels May 31, 2023
@artemiomorales
Copy link
Contributor

Ok, my first inclination would be to render the Behaviors dropdown inert and add a message stating, "Lightbox will be disabled while the image contains a link."

On the technical side, to do this, we would need to detect the image block's linkDestination to override the UI defined in packages/block-editor/src/hooks/behaviors.js. I'm not sure how to do that, but can begin exploring. Any pointers appreciated!

Pinging @jasmussen @SaxonF @jameskoster for design feedback on this approach.

@artemiomorales
Copy link
Contributor

I was looking at the original issue, and noticed that @jasmussen already expressed a way to handle this:

...it could be grayed out and have help-text that says something like "The lightbox behavior is disabled for linked images."

Barring any additional feedback, will go ahead with that approach then.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 1, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants