-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Navigation Block: Fix Anchor Support #30043
Conversation
Size Change: +5 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
Should we fix this by adding the id attribute with |
@Soean good call on the adding the id attribute to As for adding the anchor attribute, the attribute was not coming through to the PHP side in |
When we use a dynamic block we lose a lot of built-in functionality, since we're deferring rendering to the PHP callback. For example, even basic things like the block's classname needs to be added manually. This is normally called in: gutenberg/packages/blocks/src/api/serializer.js Lines 39 to 50 in a59d42d
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@georgeh This tests well for me. We could maybe get a +1 from folks to see if there's a better way. I suspect we do need to manually add this for a dynamic block.
cc @talldan @tellthemachines @noisysocks if you happen to know offhand.
Value still exists after a save/load | Serialized to frontend |
---|---|
20a0bef
to
50d14f1
Compare
I've not been involved in it but can recall PRs for server side supports properties. This folder looks like what's been tackled so far: |
Found this older PR as well - https://github.com/WordPress/gutenberg/pull/24699/files. |
#24699 appears to solve for the general case, closing this in favor of that PR |
Closes #29401
Adds support for the anchor element in the Navigation block. It was not rendering and was being lost on save due to it being a dynamic block. Adding the
anchor
attribute explicitly fixed the saving issue, and adding it to the render callback fixed the markup.Description
How has this been tested?
Tested with and without an anchor element to ensure that the
id
attribute is only set if there is one.Screenshots
Types of changes
Checklist: