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.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 3464069-7.patch | 1.61 KB | nagy.balint |
Issue fork chosen-3464069
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
Comment #3
shivansunfire commentedSolved, 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
Comment #4
shivansunfire commentedPrevious attached file patch was wrong because the MR was created to branch 3.0.x by default.
Comment #5
douggreen commentedLGTM
Comment #6
nagy.balint commentedI 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.
Comment #7
nagy.balint commentedThis patch might be more robust.
Comment #9
nagy.balint commented