Allow media items to be edited in a modal when using the field widget

Created on 11 July 2018, over 7 years ago
Updated 19 January 2023, almost 3 years ago

Problem/Motivation

In #2962525: Create a field widget for the Media library module β†’ , the media edit/view link was disabled in the field widget and widget view in order to prevent unintended data loss. Long term, we would still like the ability to quickly edit media items from the field widget, without navigating to a new page.

Proposed resolution

Allow media items to be edited in a modal while using the field widget. The Entity Browser module allows for similar functionality.

This has some major UX and possibly a11y implications, since it needs to be crystal clear to users that, if they edit a media item in the library, they are editing that item everywhere it appears.

Remaining tasks

  • Write automated tests
  • Get sign-off from the usability team
  • Get accessibility review and sign-off
  • Review code
  • Commit!

User interface changes

Undecided.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Postponed

Version

10.1 ✨

Component
MediaΒ  β†’

Last updated about 2 months ago

Created by

πŸ‡ΊπŸ‡ΈUnited States samuel.mortenson

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

  • Needs usability review

    Used to alert the usability topic maintainer(s) that an issue significantly affects (or has the potential to affect) the usability of Drupal, and their signoff is needed. When adding this tag, make it easy to review the issue. Make sure the issue summary describes the problem and the proposed solution. Screenshots usually help a lot! To get sign-off on issues with the "Needs usability review" tag, post about them in the #ux channel on Drupal Slack, and/or attend a UX meeting to demo the patch and get direct feedback from designers/UX folks/product management on next steps. If an issue represents a significant new feature, UI change, or change to the general "user experience" of Drupal, use Needs product manager review instead. See the scope of responsibilities for product managers.

  • Needs accessibility review

    Used to alert the accessibility topic maintainer(s) that an issue significantly affects (or has the potential to affect) the accessibility of Drupal, and their signoff is needed (see the governance policy draft for more information). Useful links: Drupal's accessibility standards, the Drupal Core accessibility gate.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡΅πŸ‡ΉPortugal jcnventura

    Re-roll of #142 for Drupal 10.1.x.

  • πŸ‡¨πŸ‡΄Colombia jedihe

    #148 works for me, running Drupal 9.5.3 + Gin theme.

  • πŸ‡¨πŸ‡¦Canada teknocat

    While there are other related issues that would be ideal to solve in core all with one solution, in the meantime I think the Media Library Edit contrib module is a great solution to this particular problem. It works very well, supports D10 and appears to be fairly actively maintained.

  • πŸ‡ͺπŸ‡ΈSpain miguelarber

    In a very specific scenario, when a media entity has more than a single 'file' type field (i.e.: 'book' media entity, containing a 'file' field and a 'cover' field) this patch causes the editing form to not submit properly when adding/removing the second 'file' type field (the user has to click on the 'Save' button twice, so that the changes take place).

    I have added some extra lines to make sure that the media library opener is actually the 'Field widget'. This avoids the annoying issue I described above. This patch is based on #148.

  • last update over 2 years ago
    Custom Commands Failed
  • last update over 2 years ago
    Custom Commands Failed
  • πŸ‡ΊπŸ‡ΈUnited States Chris Matthews

    I suppose it would not be advisable to get the basic functionality of the Media Library Edit β†’ or the Media Library Media Modify β†’ contrib module in Core until as phenaproxima mentioned in #109 there is ...

    dedicated funding and time from the media team, UX team, and accessibility experts to come up with a version of this feature that would be suitable for core.

    It definitely would be nice to have a Core solution but the patch in this issue is working for me.

  • πŸ‡§πŸ‡ͺBelgium victonator

    As described in #157 I came across the same issue where we had to press the 'Save' button twice.
    Patch #157 fixes this and works great for me.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @MiguelArber could we perhaps have #158 in the MR for easier review? Or as separate MR otherwise?

  • last update about 2 years ago
    Custom Commands Failed
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I opened MR !4517 with #157 ✨ Allow media items to be edited in a modal when using the field widget Postponed rebased on 11.x.

  • πŸ‡ͺπŸ‡ΈSpain miguelarber

    I am sorry for the delay, I just read the message posted by @Anybody, but I see that @dieterholvoet has already created an MR of the rebased #157. Please let me know if I can help on anything else.

    PS: I'm glad to help, thanks for testing @Victornator.

  • πŸ‡«πŸ‡·France Nicolas S. Lyon, France

    patch #153 work with a Drupal 10.1.5

  • πŸ‡ΊπŸ‡ΈUnited States byronveale

    Updated the patch in comment #157 to work with 10.1, posting here in case anybody else needs it…

  • πŸ‡ΊπŸ‡ΈUnited States byronveale

    Apologies for the noise but am attaching another patch, #165 with a minor update: added an aria-label to the Edit button, in the same fashion as the one present on the Remove button.

  • last update almost 2 years ago
    Patch Failed to Apply
  • First commit to issue fork.
  • Status changed to Active almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

    This is getting confusing to work on. There's many patches, and two open merge requests. To keep this sane and easier to review, please let's stick to updating MR !4517 only.

    I've updated it to reflect the changes #166 and made another minor fix for a PHP warning.

    I also agree with comments above that this shouldn't really be postponed without a related issue that it's waiting on. Until we have that, setting this back to "Active". I acknowledge this issue isn't likely to get anywhere without involvement from the UX team, but having the issue set to Postponed doesn't seem that will make it any more likely to happen.

  • Status changed to Postponed almost 2 years ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    This is postponed on πŸ“Œ Design a UI to allow various kinds of alterations to referenced Media entities in a modal Active which is marked as a parent.

    And it should be set to postponed because there's no point people working on this patch until a UI has been designed.

  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

    Thanks @joachim, missed that.

    Note that I think the original merge request is what was split off into a module Media Library Media Modify β†’ . This allows overrides of fields from the referenced media. AKA contextual edits. That functionality differs quite a bit from the latest patches/MR from this issue, which now just focus on presenting a simple edit button to edit the media item in a modal. Those changes affect the media everywhere it's used. It's simpler and I think has a much better chance of getting into core.

    I hope we can agree to keep this issue focused on the simple use case.

  • πŸ‡¬πŸ‡§United Kingdom joachim

    > That functionality differs quite a bit from the latest patches/MR from this issue, which now just focus on presenting a simple edit button to edit the media item in a modal. Those changes affect the media everywhere it's used. It's simpler and I think has a much better chance of getting into core.

    I agree that the override functionality is a bit specific.

    But for core we need editability AND translation, which is two items. Overriding is just a third, but the need for a UI pattern is already there.

  • πŸ‡³πŸ‡±Netherlands arantxio Dordrecht

    I created a patch for 10.2 based on the MR @bkosborne updated.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Environment: PHP 8.1 & MariaDB 10.3.22
    last update almost 2 years ago
    30,637 pass
  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

    merged 11.x into !4517

  • Pipeline finished with Success
    over 1 year ago
    Total: 510s
    #105090
  • Pipeline finished with Failed
    10 months ago
    Total: 89s
    #380456
  • πŸ‡³πŸ‡±Netherlands casey

    Snapshot of latest state of MR for safe usage with composer-patches on drupal/core:11.1.1

  • πŸ‡¨πŸ‡΄Colombia jedihe

    Updating #174 (2985168-175.patch) to include a hunk from #172 that seems to have been missed or accidentally removed (2 hooks in media_library.module).

    The re-added hunk:

    • Hides the "Delete" button from the modal
    • Makes the modal "Save" button submit via AJAX
    • Gets the media-item in the node edit form updated with any changes saved using the modal

    Minimally tested, it works well with Drupal core 11.1.7 + Gin theme.

  • πŸ‡ͺπŸ‡ΈSpain dcimorra πŸ‡ͺπŸ‡Έ Spain

    #175 works great!

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    #175 applies to 11.2 either. Thank you.

  • Pipeline finished with Failed
    15 days ago
    Total: 164s
    #619561
  • Pipeline finished with Failed
    15 days ago
    Total: 165s
    #619589
  • Pipeline finished with Failed
    15 days ago
    Total: 498s
    #619594
  • Pipeline finished with Failed
    about 14 hours ago
    Total: 187s
    #634759
  • Pipeline finished with Failed
    about 9 hours ago
    Total: 193s
    #635055
Production build 0.71.5 2024