WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11805 closed defect (bug) (fixed)

Can't delete alternate text from image in media library

Reported by: doug Owned by: azaozz
Milestone: 3.0 Priority: normal
Severity: minor Version: 2.9.1
Component: Media Keywords: has-patch tested
Focuses: Cc:

Description

Steps to reproduce:

  1. Upload an image to the media library and fill in the "Alternate text" field. Save the data.
  1. In the media library, click to edit the image.
  1. Delete all text in the Alternate text field and click Update Media.
  1. In the media library, click to edit the image again and notice that the alt text has NOT been deleted.

(The same thing happens using the pop-up style media editor from within the post editor.)

Work-around: delete all text in the Alternate text field, then type a space in the field. When updating, the alt text (including the space) will be removed.

Attachments (2)

11805.patch (601 bytes) - added by reaperhulk 4 years ago.
11805.2.patch (660 bytes) - added by miqrogroove 4 years ago.
Refreshed patch file by reaperhulk

Download all attachments as: .zip

Change History (9)

comment:1 scribu4 years ago

  • Keywords needs-patch added
  • Milestone changed from Unassigned to 3.0

Confirmed in 3.0-alpha.

comment:2 miqrogroove4 years ago

Confirmed in 2.9.1.

comment:3 McGurk4 years ago

  • Cc jonathan.wilsson@… added

comment:4 reaperhulk4 years ago

  • Cc reaperhulk added
  • Keywords has-patch added; needs-patch removed

This appears to be caused by the media_upload_form_handler testing for both isset() and !empty() on the image_alt. If you remove the !empty() it behaves as expected.

Potential issue with fix: If there are any pages that use media_upload_form_handler and pass an empty string (rather than excluding image_alt entirely when they don't want to touch it) this could cause a problem.

reaperhulk4 years ago

comment:5 miqrogroove4 years ago

  • Owner set to azaozz
  • Status changed from new to assigned

comment:6 miqrogroove4 years ago

  • Keywords tested added

+1 works as described, and makes sense to me.

miqrogroove4 years ago

Refreshed patch file by reaperhulk

comment:7 dd324 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [13283]) Allow Deletion of Media Alt text. Props reaperhulk. Fixes #11805

Note: See TracTickets for help on using tickets.