Choices-js / Choices

A vanilla JS customisable select box/text input plugin ⚡️
https://choices-js.github.io/Choices/
MIT License
6.02k stars 594 forks source link

Ajax not reload when select item was removed #1060

Open Agamich-FE opened 1 year ago

Agamich-FE commented 1 year ago

Describe the bug Drupal 9. We use Choices for our select on the ajax form. When I unselected the item - the ajax does not reload and we can see selected items on the site URL(Screenshot 2022-10-11 at 16 19 06). We use removeActiveItemsByValue () methods.

To Reproduce N/A

Expected behavior The Ajax form should reload when the item is unselected.

Screenshots N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

KateKarpenko commented 5 months ago

Hello community! I'm wondering if anyone also still experiences the issue of using choices.js with turned on Adjax-history on Drupal view? I encountered the problem that once after selecting value in exposed filter (on which is applied choices.js) to remove that item from filter I have to click twice in a row. Usual one click somehow doesn't reload a page and doesn't remove value from URL (adjax-history). But if I turn off Adjax-history and keep only Ajax - then everything works as expected. But I don't want to sacrify of adjax-history. Let me know please any ideas/thoufgts. Thanks!

I use choices on a select element (tried both single and multiple selection) in Drupal10

 const filterSubject = context.querySelector('select[name="test_filter[]"]');

        new Choices(filterSubject, {
          renderChoiceLimit: -1,
          removeItemButton: true,
          allowHTML: false,
          placeholderValue: "Subject",
        });