Skip to content

allowClear bug with multiple select from upstream select2 library #1398

@blms

Description

@blms

This bug from upstream Select2 is present in DAL: select2/select2#3335

The following monkey-patch was posted in that thread:

var AllowClear = $.fn.select2.amd.require('select2/selection/allowClear');
var _handleKeyboardClearOriginal = AllowClear.prototype._handleKeyboardClear;

AllowClear.prototype._handleKeyboardClear = function(_, evt, container) {
  if (this.$element.prop('multiple')) {
    return;
  }

  _handleKeyboardClearOriginal.call(this, _, evt, container);
};

I believe this could be applied when select2 is initialized in DAL, as it seems the select2 maintainers haven't been proactive in fixing this bug in the past 10 years.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions