michaeluno / admin-page-framework

Facilitates WordPress plugin and theme development.
http://admin-page-framework.michaeluno.jp/
Other
337 stars 71 forks source link

Select2 loses feature select2 when the field is repeated #279

Closed SUGO-es closed 5 years ago

SUGO-es commented 5 years ago

Type of issue

Prerequisites

Steps to reproduce the issue (for Bug report)

  1. Clean installation
  2. Active demo mode
  3. Go to APF demo, custom field types, Repeatable & Sortable

Expected behavior and actual behavior

The Select2 field does not have the add button, however, CSS areeglo to be displayed. The real problem is that by choosing a value and repeating, the duplicate field loses focus select2 and behaves like a normal select.

This problem arose me in a metabox with an inline and repetable field, every time I repeat the field, the select2 field that remains loses focus select2 and remains as a normal select.

Environment

Browsers

Operating System

Versions

Isolating the problem

If you need any more information, do not hesitate to ask me.

Thank you very much for this fantastic framework and for your great work.

Best regards.

Cap 1

Cap 2

michaeluno commented 5 years ago

I could confirm the problem. It seems to occur with WordPress v5.0 or above.

Thanks for the report.

michaeluno commented 5 years ago

It seems to occur with Select2 v4.0.6-rc.0 or above. For a workaround, you can replace the files under the select2-custom-field-type/select2 folder (https://github.com/michaeluno/admin-page-framework/tree/3.8.19/example/library/select2-custom-field-type/select2) with the dist files (https://github.com/select2/select2/tree/4.0.5/dist) of Select2 v4.0.5 for the time being.

SUGO-es commented 5 years ago

The solution you provide removes the bug in the current version. Thanks for the support. Best regards.

michaeluno commented 5 years ago

@xarkitu v3.8.20 should fix this without any modifications. Let me know if it doesn't.