jtsternberg / Shortcode_Button

Tinymce and Quicktag buttons for outputting shortcodes. Built to work with CMB2.
81 stars 7 forks source link

CMB2 File Field Type - Non-editable media fields #5

Closed JayWood closed 8 years ago

JayWood commented 8 years ago

If you use the file CMB2 field type, the modal window which pops up does not allow interaction with ANY input fields.

Running this in your console shows that the element is in fact clicked: jQuery( window ).on( 'click', function( evt ){ window.console.trace( evt ); } );

However, running this, shows the focus target is never changed: jQuery( 'input' ).on( 'focus', function( evt ) { window.console.trace( evt ) } )

The focus target stays as input.cmb2-upload-button.button whereas the click target is correctly targeting the inputs.

inputs-do-not-work

JayWood commented 8 years ago

This has been tracked down to specifically the input.cmb2_upload_button.

IF, when the dialog is already open, you manipulate that element in any way ( change the tag type or remove the element entirely ), the media dialog becomes editable.

Here is the full code to see what I see:

jQuery( 'input' ).on( 'focus', function( evt ) { window.console.trace( 'Focus: ',evt ) } );
jQuery( 'input' ).on( 'blur', function( evt ) { window.console.trace( 'Blur: ',evt ) } );
jQuery( window ).on( 'click', function( evt ){ window.console.log( 'Current Focus: ',jQuery(':focus') ); window.console.trace( 'Click: ',evt ); } );

You'll need to drop this in your browser's console debug. For now, I'll continue to work on this, just wanted to report what was found.

jtsternberg commented 8 years ago

Fixed in https://github.com/jtsternberg/Shortcode_Button/commit/00fd43e75357136bb9306ed421a6cdb2154d219a