-
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
Fix duplicate navigation block props #43596
Conversation
} ); | ||
const innerBlocksProps = useInnerBlocksProps( | ||
{ | ||
className: 'wp-block-navigation__container', |
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.
Matches innerBlocksProps
elsewhere.
@@ -172,18 +171,9 @@ export default function UnsavedInnerBlocks( { | |||
const Wrapper = isSaving ? Disabled : 'div'; | |||
|
|||
return ( | |||
<Wrapper className="wp-block-navigation__unsaved-changes"> |
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.
There used to be an overlay to prevent direct manipulation, but I don't think this is needed anymore. It causes the styling of the inner blocks to be incorrect. There must be direct descendent selectors among the block styles, so I think it's best to try to match the DOM structure that the block normally has.
This could do with some testing, but I believe the unsaved inner blocks are save upon editing now, and it seemed to work ok for me. It's questionable if the Disabled
wrapper is also still needed, but I left it there.
I did spot some issues that are also present in trunk, like the way links added after page list are aligned to the right:
Size Change: -445 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
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.
This works as described and it simplifies the behavior of the navigation block in a very complex area 👍🏻 👍🏻
What?
When the
UnsavedInnerBlocks
component is rendered, the block props are rendered twice in the navigation block.In this screenshot you can see the first and last elements have duplicated attributes
This PR should fix the issue.
Why?
This results in duplicated
id
attributes on two DOM elements.How?
Stop passing
blockProps
through to theUnsavedInnerBlocks
component.Once this prop was no longer present, the layout of the blocks was incorrect due to the intervening
wp-block-navigation__unsaved-changes
andwp-block-navigation__unsaved-changes-overlay
elementsTesting Instructions