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

Layout Support: Replace incremental IDs with hashes #68210

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

DAreRodz
Copy link
Contributor

What?

Changes how class names for layout containers are generated, replacing per-block, incrementally-generated IDs with hashes obtained from the layout styles definition.

Will fix #67308.

Why?

Since #67826, the Interactivity API's client-side navigation feature replaces all style sheets when navigate is called.

This currently affects the style of elements outside of router regions, even when navigating between pages generated with the same template, because layout class names depend on the number of blocks rendered using them (see #67826), which can vary.

How?

The PR adds a new function named gutenberg_unique_prefixed_id_from_array, which basically generates a short hash from the passed array.

This function is used to generate the layout container class, receiving all the data required to generate the style output. That guarantees hashes to be unique for each layout style combination.

Testing Instructions

TBD

Screenshots or screencast

Before After
Screen.Recording.2024-12-20.at.13.45.58.mov
Screen.Recording.2024-12-20.at.13.48.13.mov

@DAreRodz DAreRodz added [Type] Bug An existing feature does not function as intended [Feature] Layout Layout block support, its UI controls, and style output. labels Dec 20, 2024
Copy link

Flaky tests detected in 9c568ad.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12436771786
📝 Reported issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout styles are incompatible with Interactivity API client-side navigation
1 participant