Problem/Motivation

When using the media library to upload a new media entity the "Save and select" button is part of the content, so if the form for the media entity has multiple fields then the user needs to scroll down to see the buttons, they will only see the "Insert" and "Cancel" buttons and when they click on insert the modal is closed and no media is added.

Steps to reproduce

  • Enable the Gutenberg Experience for a content type.
  • Go to create a new content using Gutenberg.
  • Add a Media block, and click on media library button.
  • In the Add file field choose a file.
  • You should see the Save and select button as part of the form and the Insert and Cancel buttons in the modal footer
  • Click on Insert.
  • Modal will close, no media will be added to block.

Proposed resolution

Use a similar approach than Drupal core by replacing the buttons when the new media form is presented to the user, so the user should see the Save and select button there.

Issue fork gutenberg-3258284

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

jidrone created an issue. See original summary.

jidrone’s picture

Status: Active » Needs review

Merge Request created and changed to needs review.

  • jidrone committed f66207c on 8.x-2.x
    Issue #3258284: Save and select button not placed correctly
    
marcofernandes’s picture

Tested and merged. Great work! 😉

marcofernandes’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

marcofernandes’s picture

Priority: Normal » Major
Status: Closed (fixed) » Needs work
StatusFileSize
new3.51 MB

Found an issue with this implementation. When inserting a second image block (or any block that uses media browser), after hitting insert at the modal dialog, the modal will close but the overlay will be still visible and the selected image will be applied to the previous block.
Issue demo

marcofernandes’s picture

Priority: Major » Normal
Status: Needs work » Needs review
StatusFileSize
new4.45 KB

Added a patch for 2.4. I'll commit to dev branch.

  • marcofernandes committed 3a713b4 on 8.x-2.x
    Issue #3258284 by jidrone, marcofernandes: Fix modal buttons issue
    
marcofernandes’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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