Display design similar to multiple selected values when the select field allows single value.

Created on 27 August 2024, 5 months ago

Problem/Motivation

Initially, the single value select field didn't have a proper UI as the close button appeared in the extreme right corner for the selected value. The multiple select field when selected seems to have a more appealing design than the single value selected field. This creates inconsistency in the design for both the select fields.

Steps to reproduce

  1. Install the module and enable it by visiting the URL /admin/modules.
  2. Add a field of type list in a content type by visiting the URL /admin/structure/types/manage/{content_type}/fields and allow Limited 1 value to be saved.
  3. Now visit the Manage form display of the content type.
  4. Now under the Widget column for the previously created field select Select2 from the dropdown list.
  5. Repeat the steps from 2 to 4 again and allow Unlimited values to be saved for this new field.
  6. Go to node add page /node/add/{content_type} and select value from the list for the above fields.
  7. Now select value in both the created fields and check the design of both the fields.

Proposed resolution

Provide a configuration to enable/disable the design similar to the multiple values selected for the field that allows a single value.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.0

Component

User interface

Created by

🇮🇳India Tirupati_Singh

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

Merge Requests

Comments & Activities

  • Issue created by @Tirupati_Singh
  • Pipeline finished with Failed
    5 months ago
    Total: 524s
    #266125
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • 🇮🇳India Tirupati_Singh

    Hi, I've provided a new configuration option for enabling/disabling the design for single value select field similar to the multiple value select field. I've attached the screenshots for reference. Please review the MR.

  • Hello @tirupati_singh,
    I've reviewed the MR!40 and found you have included the styling for gin, claro and seven theme in the newly created file select2.single-style.scss however separate scss files are present for these theme styling. IMO we could maintain the discrete structure of styling as present in the module.
    I installed the module and followed the steps mentioned in the issue. Encountered the design inconsistency therefore applied your patch. The design of single list item was improved after enabling the checkbox in the field widget present in Manage Form Display page and now it matches the multi-select list item design. I verified the design in seven, claro and gin admin themes. I noticed few issues in case of seven theme. The style for the single list item seems to be different compared to the multi-select list item and the alignment of the dropdown button is inappropriate. It would be nice if we could makes these updates thus moving it to NW.
    NOTE: After installing the module we need to follow the steps mentioned in modules project page to integrate the select2 library.
    Attaching ss for reference.
    Thanks

  • Pipeline finished with Failed
    3 months ago
    Total: 47s
    #324381
  • Pipeline finished with Failed
    3 months ago
    Total: 46s
    #324384
  • 🇮🇳India Tirupati_Singh

    Hi @esha_kundu, I've fixed the design issue of single item list for seven. I've attached the screenshot of after fixes. Please review the changes.

    I've reviewed the MR!40 and found you have included the styling for gin, claro and seven theme in the newly created file select2.single-style.scss however separate scss files are present for these theme styling. IMO we could maintain the discrete structure of styling as present in the module.

    The reason why I included the styling in one file and not the existing files is because a new library is being attached with the Single item style widget when this functionality is enabled. If the change was to be kept in the existing file, the CSS would load even if the Single item style option was disabled.

  • Thanks @tirupati_singh for addressing the issues that I had mentioned in #4 Display design similar to multiple selected values when the select field allows single value. Active earlier. I re-reviewed the MR!40 and it looks good to me. I applied the patch which applied cleanly after that I configured the admin theme to seven. In Manage Form Display enabled the checkbox in the field widget and verified the design for the single select field elements. The alignment and design for the single select field items was improved.

    I've reviewed the MR!40 and found you have included the styling for gin, claro and seven theme in the newly created file select2.single-style.scss however separate scss files are present for these theme styling. IMO we could maintain the discrete structure of styling as present in the module.

    Regarding this suggestion that I mentioned earlier, thanks for the clarification and I acknowledge that unnecessary css should be avoided loading on a page when the Single item style option is disabled.
    Including ss for the after changes. Moving to RTBC.
    Thanks

Production build 0.71.5 2024