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

Lightbox filtering no longer working/isn't disallowing editing #59837

Closed
annezazu opened this issue Mar 13, 2024 · 3 comments · Fixed by #59890
Closed

Lightbox filtering no longer working/isn't disallowing editing #59837

annezazu opened this issue Mar 13, 2024 · 3 comments · Fixed by #59890
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Regression Related to a regression in the latest release

Comments

@annezazu
Copy link
Contributor

Pulling this out of a separate issue and copying/pasting from @justintadlock (let's make sure to create separate issues here for 6.5 problems).

It looks like the filter itself works. However, the implementation in the editor might be broken. I'm testing against WP 6.5 RC2.

This combination isn't disallowing editing:

  • allowEditing: false
  • enabled: true

With those two settings, I'm still able to change the lightbox status of an existing Image block and a newly-added Image block in the editor.

Tested with filter:

add_filter(
	'wp_theme_json_data_theme',
	fn($theme_json) => $theme_json->update_with([
		'version' => 2,
		'settings' => [
			'blocks' => [
				'core/image' => [
					'lightbox' => [
						'allowEditing' => false,
						'enabled'      => true
					]
				]
			]
		]
	])
);

I also tested this without the filter but setting it in theme.json:

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"blocks": {
			"core/image": {
				"lightbox": {
					"allowEditing": false,
					"enabled": true
				}
			}
		}
	}
}

CC: @artemiomorales

This is a change in previous behavior from WordPress 6.4 and seems to be a regression and bug to me. I don't know if it's related to a change in the Lightbox toggle in the sidebar to the new location in the Link dropdown. #57608 Or something else altogether.

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Feature] Interactivity API API to add frontend interactivity to blocks. labels Mar 13, 2024
@justintadlock
Copy link
Contributor

Thanks for opening the ticket, @annezazu. I had some more testing to do before deciding this was a definite regression, but you beat me to it. :)

I've done some more testing with Twenty Twenty-Four. These are my theme.json settings:

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"blocks": {
			"core/image": {
				"lightbox": {
					"allowEditing": false,
					"enabled": true
				}
			}
		}
	}
}

As far as I can tell, this combination of settings is the only thing that differs between 6.4 an 6.5.

With WordPress 6.4

With the above theme.json settings, the "Expand on click" toggle does not appear (user cannot edit lightbox state) in the sidebar. This would normally appear under the "Resolution" field in the sidebar.

image

With WordPress 6.5

Using the same settings, the "Expand on click" button appears in the link dropdown in the toolbar (new location):

image

@artemiomorales
Copy link
Contributor

Hey all, I created a PR to address the issue here.

@artemiomorales artemiomorales linked a pull request Mar 15, 2024 that will close this issue
@gziolo gziolo added [Type] Regression Related to a regression in the latest release and removed [Type] Bug An existing feature does not function as intended labels Mar 15, 2024
@gziolo
Copy link
Member

gziolo commented Apr 10, 2024

The fix was released in WordPress 6.5.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Regression Related to a regression in the latest release
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants