Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#42127 closed defect (bug) (fixed)

Custom HTML widget can't be deleted with error in content

Reported by: joyously's profile joyously Owned by: westonruter's profile westonruter
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.9
Component: Widgets Keywords: has-patch commit
Focuses: Cc:


In the admin Widgets page, a Custom HTML widget with an HTML error disables the Delete link.
It works correctly in the Customizer.

Attachments (2)

custom-html-widget-deletion.gif (276.1 KB) - added by joyously 7 years ago.
42127.diff (498 bytes) - added by felipeelia 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 @melchoyce
7 years ago

  • Milestone changed from Awaiting Review to 4.9

7 years ago

#2 @felipeelia
7 years ago

  • Keywords has-patch dev-feedback added

If I understood correctly, the problem here is checking for form validity even when it'll be deleted. It happens with Custom HTML Widget because it uses

control.fields.content[0].setCustomValidity( message );

but any other widget with an input field with "required" attribute would result in the same error.

#3 @westonruter
7 years ago

  • Keywords commit added; dev-feedback removed
  • Owner set to westonruter
  • Status changed from new to accepted

@felipeelia Your patch is 💯 correct.

#4 @westonruter
7 years ago

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

In 41813:

Widgets: Allow deletion even when widget form fails validity checks.

Props felipeelia.
Amends [41352].
See #23120.
Fixes #42127.

#5 @westonruter
7 years ago

In 41814:

Widgets: Clear dirty flag on widgets admin screen when widget is deleted to prevent irrelevant confirmation prompt when leaving.

Props hazimayesh, felipeelia.
Amends [41352], [41813].
See #23120, #42127.
Fixes #41894.

Note: See TracTickets for help on using tickets.