cms icon indicating copy to clipboard operation
cms copied to clipboard

Link Fieldtype doesn't work correctly when used in Navigation blueprint

Open fighter3005 opened this issue 1 year ago • 1 comments

Bug description

When trying to select an entry for the link in the sidebar, the overlay opens and closes instantly.

Bildschirmfoto 2024-08-14 um 12 27 44

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

fighter3005 avatar Aug 14 '24 10:08 fighter3005

~~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).

duncanmcclean avatar Aug 14 '24 11:08 duncanmcclean

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.

stuartcusackie avatar Aug 12 '25 10:08 stuartcusackie

Please accept the PR, had problems this issue for a while as well in a site with somewhat non standard nav. Thank you!

artemverbo avatar Aug 13 '25 03:08 artemverbo