Problem/Motivation

In the issue #2825712: The allowed values storage setting of list fields should be required the allowed values storage setting was made a required textarea, but with the introduction of multiple input fields for the allowed values setting in #2521800: List key|label entry field is textarea, which doesn't give guidance towards the expected input only the first input field is a required field which can be deleted with the Remove button and the form can be saved without any allowed values for the list field. This does not satisfy the purpose of the allowed values being required.

Steps to reproduce

  1. Create any list type field on any entity.
  2. Delete the required input field (which is the first row of the table).
  3. Save the field settings with no allowed values.

Proposed resolution

Disable the Remove button when there is a single row in the allowed values storage setting.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3382802

Command icon 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

srishtiiee created an issue. See original summary.

srishtiiee’s picture

Issue summary: View changes
lauriii’s picture

Issue tags: +Usability, +Field UX

srishtiiee’s picture

Status: Active » Needs review
kunal.sachdev’s picture

Looks good 👍. Needs work for two small nits.

kunal.sachdev’s picture

Status: Needs review » Needs work
srishtiiee’s picture

Status: Needs work » Needs review
marcoliver’s picture

Status: Needs review » Reviewed & tested by the community

Works fine! The test fail seems unrelated.

Marking as RTBC.

ckrina’s picture

Setting the button as disabled in this situation is an improvement, already as it is. So +1 for getting this in.

But it would be great if we could come up with a pattern that gives more context/feedback to the user about the "why" that button is disabled. My first thought was using the title attribute with something like "Mandatory value not removable". But title won't show up on hover if the button is disabled, plus I'm not sure it's a right use of it. Maybe, as @lauriii suggested, this could be a nice use of the Tooltip once that's in?

  • lauriii committed 2b9d2a95 on 11.x
    Issue #3382802 by srishtiiee, kunal.sachdev, marcoliver, ckrina: Disable...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 2b9d2a9 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.