Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colour picker auto-prefills HEX value #61

Open
drawcard opened this issue Jan 4, 2017 · 4 comments
Open

Colour picker auto-prefills HEX value #61

drawcard opened this issue Jan 4, 2017 · 4 comments

Comments

@drawcard
Copy link

drawcard commented Jan 4, 2017

More information & discussion: elementor/elementor#1026

@appxmitch
Copy link

This is an issue with the Iris color picker, not Elementor, and this should not be closed because this is still an issue. It remains in the current version, which is leveraged by and most obvious in Elementor, but this issue exists in Iris, which is what the person linked to in their message.

The problem is that, when three or more values exist in a hex entry, it autofills to six values immediately (F00 becomes FF0000). This creates a lot of workflow issues for people who type hex values instead of pasting them into the box; if I'm typing out FA3400, for example, and I type FA3, the hex value autofills to FFAA33. When I go to delete what has been autofilled, at FFA the picker autofills to FFFFAA. Then if I continue to backspace and it reaches FFF, the picker autofills to FFFFFF.

This continues until all the values are highlighted and deleted, including the octothorpe, and when that is done, the autofill ceases.

@creador-dev
Copy link

@appxmitch Have you found any solution for this?

@creador-dev
Copy link

creador-dev commented Oct 15, 2021

For anyone who wants a workaround for this issue. I have made one and it's working perfectly.

For this to work we need to add this js inside the plugin and which will be called at the end of the WordPress footer otherwise it won’t work as there is a function inside iris.js which we need to override to make this work. For calling this script at the end I have added a PHP script that will embed the file in the footer of WordPress.

Script for fixing autofill issue

Replace Classname with the class name of that color field.

(function ($) {
    $('.class-name').keyup(function(){
        $(this).off('keyup');
    });
})(jQuery);

PHP script to embed a file at the end

function my_scripts() {
	wp_register_script('my-script', plugin_dir_url( __FILE__ ) . 'assets/js/myscript.js','','1.1', true);
	wp_enqueue_script('my-script');
}
add_action( 'admin_enqueue_scripts', 'my_scripts' );

@buckmanhands
Copy link

Would love to see this get fixed finally. it is seriously frustrating to run into this issue in the tons of plugins that use the default color picker. Seems like a solution has been provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants