WordPress.org

Make WordPress Core

Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#42127 closed defect (bug) (fixed)

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

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

Description

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 2 months ago.
42127.diff (498 bytes) - added by felipeelia 2 months ago.

Download all attachments as: .zip

Change History (7)

#1 @melchoyce
2 months ago

  • Milestone changed from Awaiting Review to 4.9

@felipeelia
2 months ago

#2 @felipeelia
2 months 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
2 months ago

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

@felipeelia Your patch is 💯 correct.

#4 @westonruter
2 months 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
2 months 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.