Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
NavigationLink: fix getting Navigation parent block #20032
...However, I noticed a potential coding issue where we're expecting the rootBlock to always be the Nav Block:
...when in actual fact I think it could actually be any parent Block that uses
I tested this theory by:
It appears in the above scenario it doesn't work as the style wasn't applied to the Navigation Link Block, only to the parent Navigation Block.
So, in order to fix this issue what we do is adding a new
const parentNavigationIds = getBlockParentsByBlockName( clientId, 'core/navigation' );
Then it's a matter of getting the first item of the array and pick up the block attributes.
How has this been tested?
Types of changes
I've made a testing document to test this also outside the Navigation. Made Columns > Column > Cover > Paragraph and tried: