Make WordPress Core

Opened 3 years ago

Last modified 16 months ago

#54069 new defect (bug)

Media title change in "Attachment Details" dialog opened via Media Library Grid View is not informing API/plugins properly

Reported by: abitofmind's profile abitofmind Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description

Problem:
If WordPress offers different UIs to edit media titles, then all those should properly inform the respective plugin/event APIs about that change. It seems there is a discrepancy, in one place it works, in the other not. See the reproductions.

Environment / How I discovered the bug
I noticed this bug when using the plugin Media File Renamer 5.2.4 on WordPress 5.8. What I observed is very likely a bug in WordPress and not from the plugin according to the support reply of the plugin developer @TigrouMeow:

Unfortunately, I think the problem is on the Media Library ThumbView Edit Popup side [remark: The documentation calls this "Media grid view" and "Attachment details dialog" respectively]. Media File Renamer renames files based on a title change depending on specific actions in WordPress, and those actions can be also fired by other plugins. Since this plugin is mimicking the Edit Media Page of WP, it should also includes the actions. Otherwise, that will break not only the process of my plugin, but also many more.

✅ Reproduction I
1) Media Library in List View
2) Hover over a media post > Click “Edit”
3) You get to “Edit Media”
4) Change the “title”
4) Be sure that the “Renamer” widget has the file name not locked
5) In the “Save” widget click “Update”

  • Outcome as expected: The filename is changed accordingly.
  • The slug is also changed from the filename change, due to the Media File Renamer plugin config:
    • Advanced > Fields Syncing > Slug/Permalink: [√] Sync with filename

❌ Reproduction II
1) Media Library in Grid View
2) Click on a media thumbnail
3) A dialog/popup opens, entitled Attachment details
4) Change the “title”
5) Optional step for observation purposes: Click into the next field, or TAB into the next field. You see a saving indicator.
6) Close the popup. (If you skipped 5, you very briefly see the saving indicator while the popup closes)

  • Actual: The title is changed, the filename not!
  • Expected: Whichever of Media File Renamer's sync settings are active (title, filename, slug) kick in here in this editing method as well.

Change History (3)

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


3 years ago

#2 @abitofmind
16 months ago

This bug still exists (16 months later)

  • As a workaround I use solely the list view and from there get to the oldschool “Edit Media” page, which works.
  • But I'd love to use the grid view and use the more contemporary popover UI to change media details.

#3 @abitofmind
16 months ago

Note

  • Thanks to @adamsilverstein who investigated a problem of undesired "Kebab-Case-Titles" in media titles after drag'n'dropping images in the Block Editor (Gutenberg). Root cause turned out to be in the REST API which handles the media title differently than the regular media uploader.
  • The Gutenberg bug was closed.
  • A REST API bug will have to be created (in which Adam's fix should be reviewed, as I understood him)

Prior that we should complete the investigation

  • @adamsilverstein or anyone else, could this very issue here be related to REST API media title handling too, which the Modal Media Dialog may use (compared to the classic Media Detail Page) ?
Note: See TracTickets for help on using tickets.