Make WordPress Core

Opened 4 days ago

Last modified 5 hours ago

#65302 new defect (bug)

Model Window Insert Media Insert button not visible on default color scheme

Reported by: neo2k23's profile neo2k23 Owned by:
Milestone: 7.0.1 Priority: normal
Severity: normal Version: trunk
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

Hi

The Model Media select window "Select Image" button disappears on the default color screen when a image is selected.

See attached images

Please provide a fix

Thank you

Attachments (5)

color-scheme-set.jpg (116.0 KB) - added by neo2k23 4 days ago.
no-image-selected.jpg (236.7 KB) - added by neo2k23 4 days ago.
images-selected-button-gone.jpg (335.2 KB) - added by neo2k23 4 days ago.
Select Image button gone if image is selected
no-admin-color.jpg (353.1 KB) - added by neo2k23 40 hours ago.
--wp-admin-theme-color is not defined !
buttongone.jpg (963.1 KB) - added by neo2k23 20 hours ago.
updated to 7.1 same issue.

Download all attachments as: .zip

Change History (10)

@neo2k23
4 days ago

Select Image button gone if image is selected

#1 @jorbin
3 days ago

  • Keywords reporter-feedback added

I've tested in both the default editor and using the classic editor plugin and can't replicate this. @neo2k23 Can you please ensure this issue is present while using a default theme and without any plugins active and also provide clear steps to reproduce (you may want to consider making and uploading a screen recording if that is easier)

#2 @neo2k23
3 days ago

The theme uses this code

https://mikejolley.com/blog/2012/12/21/using-the-new-wordpress-3-5-media-uploader-in-plugins/

Btw It does not happen when you select another color scheme for the user. It only happens in the default color scheme.

Does that set you in the correct direction?

The theme is using this code.

			var file_frame;

			jQuery('.theme-add-media-button').on('click', function( event ){
				var button = $(this);
    			var target = button.data('target');
				var return_id  = button.data('return_id');
				var media_type = button.data('media_type');
				
				if (typeof media_type === 'undefined'|| media_type==null || typeof media_type == 'string' && !media_type.trim()) media_type='image';
				if (typeof return_id === 'undefined'|| return_id==null || return_id!=false && return_id!=true) return_id=true;
		
    			//button.blur();
                button.trigger('blur');
				event.preventDefault();

				// If the media frame already exists, reopen it.
				//if ( file_frame ) {
				  //file_frame.open();
				  //return;
				//}
				
				// Create the media frame.
				file_frame = wp.media.frames.file_frame = wp.media({
				  title: jQuery( this ).data( 'uploader_title' ),
				  library: { type : media_type },
				  button: {
				    text: jQuery( this ).data( 'uploader_button_text' ),
				  },
				  multiple: false  // Set to true to allow multiple files to be selected
				});

				file_frame.on( 'select', function() {
					attachment = file_frame.state().get('selection').first().toJSON();
					imagewidth = $('#'+target+'_preview').attr('data-imagewidth');
					if(parseInt(attachment.width,10)<parseInt(imagewidth,10)){
						imagewidth = attachment.width;
					}
					if($("#"+target).length>0){
						if (media_type.toLowerCase().includes('video')) {
							if (return_id===true) $("#"+target).val('{"type":"attachment_id","value":"'+attachment.id+'"}');
							else $("#"+target).val('{"type":"attachment_url","value":"'+attachment.url+'"}');
							$("#"+target+"_preview").html('<div class="thickbox"><figure class="wp-block-video"><video autoplay controls loop muted src="'+attachment.url +'" style="width:100%;max-width:240px;height:auto;"></video></div></figure>');
						} else {
							if (return_id===true) $("#"+target).val('{"type":"attachment_id","value":"'+attachment.id+'"}');
							else $("#"+target).val('{"type":"attachment_url","value":"'+attachment.url+'"}');
							$("#"+target+"_preview").html('<a class="thickbox" href="'+attachment.url+'?"><img  width="'+imagewidth+'" src="'+attachment.url+'"/></a>');
						}
					}
				});

				file_frame.open();
			});
Last edited 3 days ago by neo2k23 (previous) (diff)

#3 @wildworks
44 hours ago

  • Milestone changed from Awaiting Review to 7.0.1

This issue is similar to #64840, where the fallback value for the default primary color might not be applied correctly. There might be a case where the fallback is not applied.

@neo2k23, Is it possible to download the theme where the issue is occurring so we can investigate it?

#4 @neo2k23
41 hours ago

@wildworks Please checkout your direct message on slack.

Btw it looks like exact the same issue https://core.trac.wordpress.org/ticket/64840

but the base styles are enqueued. If i select a another color scheme for the user there is no issue and the button shows. It is only in the default wordpress color scheme which is set by default to the user

Last edited 20 hours ago by neo2k23 (previous) (diff)

@neo2k23
40 hours ago

--wp-admin-theme-color is not defined !

@neo2k23
20 hours ago

updated to 7.1 same issue.

#5 @wildworks
5 hours ago

@neo2k23 On which screen and how is that media modal built? Normally, in the WordPress dashboard, --wp-admin-theme-color should be defined by default.

Note: See TracTickets for help on using tickets.