Query fragments or anchors on internal URLs in link fields get lost on re-editing

Created on 10 May 2023, over 1 year ago
Updated 16 May 2023, over 1 year ago

Problem/Motivation

An anchor added to URL path in link fields is saved initially, but when you edit the entity again, it gets lost.

Steps to reproduce

  1. Edit a node with a link field that's configured to use the Linkit widget.
  2. Use the autocomplete funcationality, or enter an alias path manually to select a link target.
  3. Add a URL fragment to the path, e.g. #foo.
  4. Save the node. In the front-end, the link will contain the fragment.
  5. Edit the node again. The URI field gets prefilled with the linked entity's alias path, but without the fragment.
  6. Save the node again. In the front-end, the link will NOT contain the fragment any more.

The same might happen to a manually added query string.

I see lots of work has been done for a similar task in ✨ Add better support for linking to anchors Postponed: needs info , but for the filter, not the widget.

Proposed resolution

Append fragment (and query string) to the entity's URL alias when filling the URI field.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

6.1

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany mrshowerman Munich

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024