Problem/Motivation

Recently Better Exposed Filters support for Chosen integration was removed in Remove "chosen-js" support. They removed some code that took into account the Chosen input to search in the select so it wouldn't be autosubmitted automatically right after writing. That code had been previously added in Do not autosubmit view if using a chosen.js search widget but caused other problems.

Steps to reproduce

As a consecuence, after updating to Better Exposed Filters to 6.0.4 or newer, and using Chosen on a select filter, makes the input search unusable because it auto-submits the form right after the user type just a character.

Proposed resolution

As it says in the issue, Better Exposed Filters module already has a way to disable automatic submission of input fields using the [data-bef-auto-submit-exclude] attribute. So we just need to add that attribute to the element when the module is enabled.

CommentFileSizeAuthor
#7 3464069-7.patch1.61 KBnagy.balint
#3 3464069-3.patch34.49 KBshivansunfire

Issue fork chosen-3464069

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

juanolalla created an issue. See original summary.

shivansunfire’s picture

Status: Active » Needs review
StatusFileSize
new34.49 KB

Solved, I've opened a Merge Request. There is a failure in the pipeline regarding phpUnit which doesn't seem to be anything related to the changes.

Patch: https://git.drupalcode.org/project/chosen/-/merge_requests/14.diff

shivansunfire’s picture

Previous attached file patch was wrong because the MR was created to branch 3.0.x by default.

douggreen’s picture

LGTM

nagy.balint’s picture

Status: Needs review » Needs work

I understand that this is an integration, and we would not like to put this in the main javascript file.

However there is no guarantee that this script will run after the "chosen" library already applied itself.

Instead of relying on document ready calls in a behavior which can be called by Drupal several times on a page, it would be better to somehow guarantee that the code runs after the chosen library ran, and that this script is using the "once" function instead of document ready.

nagy.balint’s picture

Status: Needs work » Needs review
StatusFileSize
new1.61 KB

This patch might be more robust.

  • nagy.balint committed c806ac7b on 4.0.x
    Issue #3464069 by juanolalla, nagy.balint: Add Better Exposed Filters...
nagy.balint’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.