Problem/Motivation
If you enable the 'Hide top bar' option after visiting a node form where the local tasks have been moved to the top bar, the local tasks do not appear as tabs like expected.
Steps to reproduce
On a fresh install:
- Login as admin and enable the navigation module
- Visit any node. Make note that the local tasks tabs have moved into the Top Bar
- Visit the Navigation Settings (Adminstration > Configuration > User interface > Navigation settings)
- Enable 'Hide top bar' and Save
- Reload the node from step 2
Expected results
Top bar is hidden and the local tasks display as tabs.
Actual results
Top bar is hidden, and so are the tabs. Local tasks are inaccessible.
Proposed resolution
Clearing cache fixes the issue. There is a cacheing issue at play where the top bar, or some sub-element is not declaring the navigation configuration as a cache dependency.
Remaining tasks
Fix it.
User interface changes
When top bar is hidden, local tasks show as tabs. When top bar is present, local tasks show as dropdown.
API changes
None.
Data model changes
None.
Issue fork navigation-3418416
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
m4oliveiComment #5
plopescAdd logic to take into account hide_top_bar property and ensure that local tasks are rebuilt when navigation settings form is submitted.
Comment #7
m4olivei@plopsec I took a different approach by instead of invalidating another modules cache tag, properly declaring our cacheability metadata, which I think is the better way to solve this. Let me know what you think. Open to being told I'm wrong 🙂.
https://git.drupalcode.org/project/navigation/-/merge_requests/171
Comment #9
plopesc@m4olivei Checked your code and it looks cleaner and better for the long run than my original approach.
Closed my MR and marking this issue as RTBC.
Thank you for bringing a second point of view to the issue!
Comment #10
m4oliveiMy pleasure! Always count on cacheability in Drupal to bring out complications and multiple approaches 😀. Thanks for the review.
Comment #12
ckrinaMerged. Thanks!