1 | | I just came across this issue when integrating [JS Widgets](https://github.com/xwp/wp-js-widgets) into the widgets admin screen. The direction I took was analogous to what is done in the customizer (surprise), where if the widget is not saved yet then the button says “Save” as it does currently, but once the widget has been updated (and the `widget-updated` event triggers) then the button becomes `disabled` and the text changes to “Saved”. Upon making another change to the widget, then the button becomes enabled again and the text returns to “Save”. In the case of an HTTP error, then the enabled Save button just will never turn to Saved. If the `WP_JS_Widget` failed a validation constraint, then the button would remain “Save” but a validation notification would appear in the control. |
| 1 | I just came across this issue when integrating [https://github.com/xwp/wp-js-widgets JS Widgets] into the widgets admin screen. The direction I took was analogous to what is done in the customizer (surprise), where if the widget is not saved yet then the button says “Save” as it does currently, but once the widget has been updated (and the `widget-updated` event triggers) then the button becomes `disabled` and the text changes to “Saved”. Upon making another change to the widget, then the button becomes enabled again and the text returns to “Save”. In the case of an HTTP error, then the enabled Save button just will never turn to Saved. If the `WP_JS_Widget` failed a validation constraint, then the button would remain “Save” but a validation notification would appear in the control. |