Skip to content

Image Block: Right-click context menu is unavailable #70425

Description

@t-hamano
  • Props to @megane9988 for discovering this problem.
  • Note: I'm not sure if this is considered a bug by everyone, but it feels like one to me.

Description

Most popular browsers provide image-specific context menus when you right-click on an image in a document, such as "Open image in new tab" or "Save image as...".

Image

However, due to the effects of the following two PRs, it is no longer possible to right-click on an image within the Image block:

This issue will occur not only with the Image block, but with any block that contains images.

There are two causes for this problem:

  1. To enable dragging of blocks, we disable the browser's default image dragging:

    .wp-block img:not([draggable]),
    .wp-block svg:not([draggable]) {
    pointer-events: none;
    }

  2. Because the ResizableBox component exists in parallel with the img element, we cannot right-click on the image:

    <figure class="block-editor-block-list__block wp-block wp-block-image">
      <img />
      <div class="components-resizable-box__container has-show-handle">
      </div>
    </figure>

I'm not sure if this is technically possible, but I'm wondering if it's possible to enable the right-click menu for images while maintaining the following two functions:

  • Blocks containing images can be dragged with the mouse
  • The drag handle of the ResizableBox component can be operated

cc @stokesman @ellatrix

Step-by-step reproduction instructions

  • Insert an Image block.
  • Right-click the image.
  • Confirm the browser menu items.

Screenshots, screen recording, code snippet

When I right-click on an image, no image-specific menu appears.

Image

Environment info

No response

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

Please confirm which theme type you used for testing.

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

Activity

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

Metadata

Metadata

Assignees

Labels

[Block] ImageAffects the Image Block[Status] In ProgressTracking issues with work in progress[Type] RegressionRelated to a regression in the latest release

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions