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
- Write a patch
- Review
- 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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3101808-2.patch | 1.94 KB | idebr |
Comments
Comment #2
idebr CreditAttribution: idebr at iO commentedConsidering 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.
Comment #3
LendudeUpdated the IS a bit to reflect the direction of #2
Comment #4
LendudeMakes 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.
Comment #5
phenaproxima+1, I believe this is dead code and should be removed.
Comment #6
seanBThanks 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.
Comment #7
alexpottCommitted 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.