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

Image: False values are not persisted in memory when used for lightbox configuration in theme.json #54638

Closed
artemiomorales opened this issue Sep 19, 2023 · 0 comments · Fixed by #54639
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@artemiomorales
Copy link
Contributor

Description

If you set the following in your theme.json...

"settings": {
    "blocks": {
        "core/image": {
            "lightbox": {
                "enabled": false,
                "allowEditing" false
            }
        }
    }
}

...rather than persisting as false in the in-memory representation of the theme.json, these values are filtered out.

While functionally these values being undefined rather than false may result in the same behavior in most cases, this appears to be a bug and makes it difficult to achieve consistency in #54544 and #54635.

Step-by-step reproduction instructions

  1. In the screen-block.js file, add a console.log for rawSettings around line 95.
  2. Open your web inspector and go to the Image settings in the Global Styles.
  3. See that the lightbox.allowEditing: true from the default Gutenberg theme.json is visible in the logged statement as expected.
Screenshot 2023-09-19 at 7 26 42 PM
  1. Modify your theme's theme.json to include the following setting to overwrite the default allowEditing value:
"settings": {
    "blocks": {
        "core/image": {
            "lightbox": {
                "allowEditing" false
            }
        }
    }
}
  1. Revisit the Image settings in the Global Styles, and see that the rawSettings no longer contains a value for lightbox at all.
Screenshot 2023-09-19 at 7 30 20 PM

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@artemiomorales artemiomorales added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Feature] Interactivity API API to add frontend interactivity to blocks. labels Sep 19, 2023
@artemiomorales artemiomorales changed the title Image: 'False' values are not read when use for lightbox configuration in theme.json Image: 'False' values are not read when used for lightbox configuration in theme.json Sep 19, 2023
@artemiomorales artemiomorales changed the title Image: 'False' values are not read when used for lightbox configuration in theme.json Image: 'False' values are not persisted when used for lightbox configuration in theme.json Sep 19, 2023
@artemiomorales artemiomorales changed the title Image: 'False' values are not persisted when used for lightbox configuration in theme.json Image: 'False' values are not persisted in memory when used for lightbox configuration in theme.json Sep 19, 2023
@artemiomorales artemiomorales changed the title Image: 'False' values are not persisted in memory when used for lightbox configuration in theme.json Image: False values are not persisted in memory when used for lightbox configuration in theme.json Sep 19, 2023
@artemiomorales artemiomorales added the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Sep 27, 2023
@mikachan mikachan removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants