kallookoo / wp-color-picker-alpha

Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
GNU General Public License v2.0
132 stars 88 forks source link

Color selection isn't triggering change #43

Closed maddisondesigns closed 3 years ago

maddisondesigns commented 4 years ago

Thanks again for all your work on this control. I have a library of Customizer Custom Controls that I've created. One of those controls uses your excellent WP Color Picker Alpha script.

With your recent fixes for WP 5.5 compatibility, I've been updating my controls, but I'm having issues with this new script. I've implemented the data attribute changes that you've made in this latest version, and the color picker is showing as expected in the Customizer. The problem though, is that whenever I select a colour, the change isn't being triggered and the Publish button never becomes enabled.

Vid: https://share.getcloudapp.com/2NujDKlG

To test this better, I've created a simple plugin that creates two sample color controls. You can download the plugin in my wp-colorpicker-test repo.

I'm hoping it's just something that I've stupidly missed, but at the moment, I'm not seeing anything.

The inc/custom-controls.php file contains all my custom controls that I've created, but this plugin only uses two. My Simple Notice Control, and the WPColorPicker Alpha Color Picker Custom Control.

kallookoo commented 4 years ago

Hi @maddisondesigns

What you comment is not a problem of the script. The customize works independently and you must add the necessary code to make it work. Like for example what I did in the plugin, but you can also look at the WordPress core.

https://github.com/kallookoo/wp-color-picker-alpha-plugin/blob/master/assets/js/customize-color-picker-alpha.js https://github.com/WordPress/WordPress/blob/master/wp-admin/js/customize-controls.js#L4127

maddisondesigns commented 4 years ago

Sorry, I don't really understand why you say it's not a problem with the script. The previous script handled this.

Previously, when creating a WP Color Picker Alpha control in the customizer, there wasn't any need to manually handle change events. If you selected a new color in the picker, the change would be triggered automatically and the publish button was enabled. Now with this new script, the functionality seems to have changed significantly and you're saying that this functionality needs to be handled independently.

kallookoo commented 4 years ago

Hi @maddisondesigns Let me explain, in the other version it would overwrite many parts and force the update since another user commented that in some cases the change was not executed. As now I only change the minimum I no longer force the change and it acts as the original script would. Take the test, because I'm telling you from memory. Sorry for the inconvenience but I think it is better not to modify so many parts of the original script to maintain better compatibility. I reopen the issue in case I'm making a mistake.