jquery select2 标记 safari 中的错误

jquery select2 tags bugs in safari

在调整为移动尺寸的桌面上一切正常。它是 Ruby 上的 Rails 应用程序。

错误 #1

我不知道如何描述这个,但是当我在我的 Safari iphone 上输入字母(调用 select2)时,它 shakes/jolts/moves 上下输入每个字母。

错误 2

在输入标签并按下 Iphone 键盘上的 "done" 后,select2-dropdown 有时会保持打开状态。这是非常挑剔的。


脚本:

$(document).on('page:change', function () {
  $('.tags').select2({
    placeholder: 'Click to select',
    tokenSeparators: [','],
    tags: true,
  });
});

从观点来看:

<%= f.input :tag_list, input_html: { class: 'tags', multiple: "multiple" }, collection: ActsAsTaggableOn::Tag.all, value_method: :name, label: "Tags" %>

Css

.modal-footer.photoform {
  .select2-container {
     margin: 10px 5px 15px 5px;
     width: 90% !important;
     float: left;
     overflow: hidden;
       li.select2-selection__choice {
         background-color: white;
         color: black;
       }
   }
   input.select2-search__field {
        width: 120px !important;
        margin-bottom: 2px;
        color: black;
   }
  }

这不是一个完美的解决方案,但这是我们通过搜索可以做的最好的解决方案:

$('select').select2({
  ajax: {
    url: '/example/api',
    delay: 250
  }
});

Select2 options

A request is being triggered on every key stroke, can I delay this? By default, Select2 will trigger a new AJAX request whenever the user changes their search term. You can set a time limit for debouncing requests using the ajax.delay option.