Site logo

Archived topic

Hide title -Disable Elements anomaly

13 replies · Started by vast on November 18, 2021

Viewing posts 1–14 of 14

Hi there,

When the 'Disable elements' is first activated, an eye icon appears next to the icon. After exiting a page/post and when editing it again, the eye icon disappears. There is still the option to disable an element in the layout metabox.

Oddly, the icon reappears if a change is made to the functions file e.g. remove a statement. For example removing the block of code below.

function generatepress_child_enqueue_scripts() {
	if ( is_rtl() ) {
		wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
	}
}
add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );

It appears briefly and the same issue occurs if the page/post is edited. If the block of code is added back in again, the icon appears and then disappears again.

There are no other blocks of code in the functions.php file.

Hi there,

Does this issue occur if you use activate parent theme to test?

Let me know :)

Hi Leo,

Can you elaborate on "Does this issue occur if you use activate parent theme to test?"?

There are no other blocks of code in the functions.php file.

This suggests that you are using a child theme and I'm asking if you can activate the parent theme to test.

To be clear, are you suggesting to deactivate the child theme? The reason the child theme is activated is because there will be functions we'll be introducing.

To be clear, are you suggesting to deactivate the child theme?

Yes - for testing and debugging purpose.

You can also create a staging site if this is a live site with traffic.

Deactivating the child theme and enabling the parent theme does not change the behavior.

Strange - the eye you're seeing is a core theme feature. It definitely shouldn't care whether you make a change to your child theme.

Are there any console errors when it disappears?

Hi Tom,

There are no console errors. Isn't the icon added by GeneratePress as a shortcut - https://generatepress.com/gutenberg/?

From testing, we've noticed the following:
1) The icon appears when logging into WordPress followed by editing a page. When exiting the page and re-entering to edit it, the icon disappears.

2) The icon appears consistently if the Chrome web developer tools window is open prior to editing the page. The icon appears when toggling all available screen sizes.

3) The icon appears when a change is made to the child theme functions file followed by editing a page. When exiting the page and re-entering to edit it, the icon disappears.

This occurs across all browser types e.g. Firefox, Chromium

Thanks Tom. Is there a dependency on a particular version of jQuery?

It should just use the version packaged with WordPress - it's not doing anything overly special.

Thanks Tom. Does the function use blocks.min.js?

If yes, the console window generates the following output when it doesn't display the eye icon.

Block successfully updated for core/button (ObjectapiVersion: 2attributes: {url: {…}, title: {…}, text: {…}, linkTarget: {…}, rel: {…}, …}category: "design"deprecated: (8) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]description: "Prompt visitors to take action with a button-style link."edit: ƒ (e)example: {attributes: {…}}getEditWrapperProps: n=>{let o={};return t&&(o=t(n)),Lc(o,e,n)}icon: {src: {…}}keywords: ["link"]merge: (e,{text:t=""})=>({...e,text:(e.text||"")+t})name: "core/button"parent: ["core/buttons"]providesContext: {}save: ƒ ({attributes:e,className:t})styles: (2) [{…}, {…}]supports: {anchor: true, align: true, alignWide: false, color: {…}, typography: {…}, …}title: "Button"usesContext: []variations: []__proto__: Object).

In contrast, the console window displays the results below when the eye icon is shown.

Block successfully updated for core/button ({name: "core/button", icon: {…}, keywords: Array(1), attributes: {…}, providesContext: {…}, …}).

No, those are core deprecation notices letting you know they've updated a block on the page.

This particular code is handed in the block-editor.js file in the theme directory. My guess is that something is delaying the loading of the metabox that the theme checks for before adding the eye. If the metabox option doesn't exist, the eye is useless and the theme doesn't add it.

This archived topic is closed to new replies.