Problem/Motivation

The initial implementation for the media library widget in #2962525: Create a field widget for the Media library module included a warning triggered by JavaScript when clicking links to prevent data loss. However, this warning is only relevant for links opening in the same window and links were removed from the widget in #3039829: Remove link to media item from media library view. so this is no longer relevant (and not used) in core.

Proposed resolution

Do not warn users of unsaved changes to the form when clicking links that open in a new window.
Let's remove this untested and unused functionality from core.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

The enables the media_library_edit contrib module to open a link without the data loss warning.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#2 3101808-2.patch1.94 KBidebr
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
FileSize
1.94 KB

Considering Drupal Core no longer ships the media library items with a link #3039829: Remove link to media item from media library view., the warning is also redundant. Let's remove it so we can up with a better implementation in media_library_edit contrib.

Lendude’s picture

Issue summary: View changes

Updated the IS a bit to reflect the direction of #2

Lendude’s picture

Status: Needs review » Reviewed & tested by the community

Makes sense to me to remove this. It's unused and untested in core, and if we want this kind of warning it would be better to come up with something more generic instead of something specific to media library. Navigating away and the resulting data loss is not a 'media library only' problem.

phenaproxima’s picture

+1, I believe this is dead code and should be removed.

seanB’s picture

Thanks for creating the issue. Since we no longer ship with links by default this also makes sense to me. We had to do something at the time, but I never liked this solution anyway. So +1 for ripping this out.

Also good to know there is something like media_library_edit in contrib. Haven't seen that one yet.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed b3aa868491 to 9.0.x and ebda038646 to 8.9.x. Thanks!

Seems reasonable to remove unnecessary and untested code. I've thought about release notes and what would happen if some contrib or custom code expects this to be there but I think that that is very edge case-y and the contrib module this blocks points out.

  • alexpott committed b3aa868 on 9.0.x
    Issue #3101808 by idebr, Lendude: Do not warn users of unsaved changes...

  • alexpott committed ebda038 on 8.9.x
    Issue #3101808 by idebr, Lendude: Do not warn users of unsaved changes...

Status: Fixed » Closed (fixed)

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