-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Only register anchor attribute for dynamic blocks with render callback. #48246
Conversation
The way to check |
Flaky tests detected in 0ac424a. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4259941579
|
I have rebased the branch to fix failing performance tests. @t-hamano, did you get a chance to test this solution? |
I have not tested this PR yet, but Therefore, my approach is as described in this comment:
I'm sure you are familiar with block support and backward compatibility, so if you have any ideas on what approach would work best, please let us know 🙏 |
Thanks for the ping @t-hamano 👍 Unfortunately, I'm not familiar at all with the anchor support. In general though, because we can't forcibly update saved content for blocks, each block support itself needs to ensure it maintains backward compatibility. You make a great point regarding the blocks that do save content but still have render callbacks. As such, the straightforward check of The blocks with both a callback and saved content are an issue, however, I still consider these to be dynamic given they get altered at runtime. I know its semantics but this lack of a clear delineation might lead to additional confusion. Particularly, if we are using the term "dynamic" in the proposed documentation and block.json changes. All that said, I can't think of any elegant solutions, this late on a Friday evening 🙂 One alternative to requiring block authors to manually define and maintain an anchor attribute might be a tweak to the block.json supports config. Maybe something could be added or supported there that flags the anchor attribute needs registering. This would make the anchor support behave a little differently to others, but it already does, so maybe its not a blocker? |
Thank you for the advice!
Yes, agree. I think that the word "dynamic" in the block can mean either of the following, depending on the context:
I believe the former is what is meant by the term "dynamic block" in this case. I think it would be better to update the anchor property of From:
To:
@Soean |
What?
The anchor attribute should only be registered for the dynamic blocks. Otherwise static blocks will get this attribute which will break this blocks.
Why?
Fixes #48232