[regression] Text field's label is duplicated in the value when edited & saved using Quick Edit

Created on 18 February 2016, over 8 years ago
Updated 24 May 2024, 4 months ago

Problem/Motivation

When using the Quick Edit function on a text field with a field label above it, the field label is inserted in the field value.

Steps to reproduce

1. Clean install, standard profile
2. Add a field "Summary" (long text, plain) to the Article content type
3. Create a new Article node and go to that page
4. Click the pencil icon on the node content and choose "Quick edit"
5. Click the summary field (Notice how the Field label becomes editable too), make a change, and click "Save"
6. Notice that the field label has been duplicated in the field content: the field content now starts with "Summary"

Proposed resolution

t.b.d.

Remaining tasks

t.b.d.

User interface changes

Probably none.

API changes

Probably none.

Data model changes

Probably none.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇳🇱Netherlands marcvangend Amsterdam

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update 4 months ago
    Waiting for branch to pass
  • 🇩🇪Germany ckaotik Berlin

    I've added a test case for this and hope it makes sense. My approach is a bit different, I look for the .field__label class (instead of both .field__label and .field__item) and add contenteditable="false" to those. If such a label was found, the user cannot edit it, to hopefully prevent some confusion. Label contents are stripped from the saved value. If there's no dedicated label, everything stays the same as before.

    The general problem is that we need some way to figure out what's the label and what's the actual value we want edited. This is however highly dependent on the theme :( So for now, you'd need to add that field__label class to your templates.

  • Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update 4 months ago
    Waiting for branch to pass
  • 🇩🇪Germany ckaotik Berlin

    Follow-up patch that fixes restoring the original field after changes were made and discarded.
    We should probably also add tests for "the label is displayed as expected after discarding changes".

  • Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update 4 months ago
    Waiting for branch to pass
  • 🇩🇪Germany ckaotik Berlin

    Fix whitespace, thanks text editor... Also added an interdiff.

Production build 0.71.5 2024