Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-21263

Upgrade select2 to stable version 4.0.4 and fix compatibility issues in Civi

    Details

    • Type: Bug
    • Status: Won't Do
    • Priority: Major
    • Resolution: Won't Do
    • Affects Version/s: 4.7.25
    • Fix Version/s: Unscheduled
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      Yes

      Description

      Currently, Civi is using select2 3.5 which we need to upgrade to latest stable 4.0.4 (https://github.com/select2/select2/releases) and also resolve compatibility issues with CiviCRM.

      Major issues:
      1. Auto appending values doesn't work anymore
      Error: Uncaught TypeError: Cannot read property 'prop' of undefined
      LOC - https://github.com/civicrm/civicrm-core/blob/master/js/crm.searchForm.js#L9
      Reference - https://select2.org/upgrading/migrating-from-35#select2-val

      2. Placeholder broken
      Error: Uncaught TypeError: Cannot read property 'id' of undefined
      As per 3.5 - placeholderOption is used to set the placeholder value for select2 widget
      As per 4.0.4 - placeholder option can now accept placeholder value both in string and object
      Reference - https://select2.org/upgrading/migrating-from-35#more-flexible-placeholders

      3. EntityRef select2 fields are broken
      Error: Uncaught Error: No select2/compat/initSelection
      As per 4.0.4 - Removed the requirement of 'initSelection'
      Reference - https://select2.org/upgrading/migrating-from-35#removed-the-requirement-of-initselection

      4. Navigation menu style is not applied
      Error: Uncaught TypeError: Cannot read property 'prop' of undefined
      As per 4.0.4 - $("select").val("1").trigger("change"); // instead of $("select").select2("val", "1");
      Reference - https://select2.org/upgrading/migrating-from-35#select2-val

      Minor issues
      1. Multi select2 widget doesn't show downarrow placeholder icon
      2. select2 css style aren't applied after upgrade

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              monish.deb Monish Deb
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: