Link Fieldtype doesn't work correctly when used in Navigation blueprint
Bug description
When trying to select an entry for the link in the sidebar, the overlay opens and closes instantly.
How to reproduce
Use a table (grid) for a navigation element and put a field inside that opens and overlay, like linking a collection entry.
Logs
No response
Environment
"php": "^8",
"eminos/statamic-tabs": "v1.2.0",
"laravel/framework": "v11.20.0",
"laravel/tinker": "v2.9.0",
"statamic/cms": "v5.21.0",
"thoughtco/statamic-restrict-fields": "v1.1.0"
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
~~Can you provide the YAML for the navigation's blueprint? You can find it in resources/blueprints/navigation.~~
Nevermind, just discovered it happens when you use the Link fieldtype anywhere in a navigation blueprint. It's not specific to using it in the context of a Grid fieldtype.
For future reference: it seems like the initialOption/initialSelectedEntries props are empty when you save a nav item, then re-open it (without a page refresh).
The behaviour is slightly different when using a replicator:
- Grid:
- selecting a link closes the menu
- Replicator:
- selecting a link does not close the menu but with a manual close and re-open the link value is hidden.
- Even though the link values are not visible on re-open, saving the navigation will actually persist the values, and you will see them on refresh.
Note that there are similar problems with images in nav blueprints too.
Trying to build a mega menu here and this seems like the best way to go. Would be great to get this solved soon. The PR seems to have taken all of this into account.
Thanks.
Please accept the PR, had problems this issue for a while as well in a site with somewhat non standard nav. Thank you!