Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text fields are auto-submitted before user have finished typing keywords #5

Closed
simone960 opened this issue May 18, 2021 · 3 comments
Closed

Comments

@simone960
Copy link

I have experienced this especially on mobile, I haven't finished typing it already start searching. Wondering if something can be done to improve this situation. I saw the issue posted and fixed. But it's for Drupal 8.

https://www.drupal.org/project/better_exposed_filters/issues/2921744

@yorkshire-pudding
Copy link

I've experienced this too. It also removes the focus from the text field.
I've had a look at the patch but I don't think this can be applied to the D7 module.

For D7/Backdrop, this actually seems to be a core issue rather than specific to BEF
Two possibilities:

backdrop/backdrop-issues#3166
The PR linked to this seems to work. I followed the advice to up to 250.
I created a new PR as it couldn't be patched
backdrop/backdrop#4643

It's fine on desktop but not great on mobile.

Next, I created a custom module with this hook in:

/**
 * Implements hook_form_alter().
 */
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_exposed_form') {
    $form['fieldname']['#attributes']['class'] = array('autosubmit-exclude');
    $form['fieldname']['#description'] = t('Press enter to include the text filter.');
  }
}

This disables autosubmit for the text field and responds to enter. What you include in the description is up to you but I did feel it needed something.

@laryn
Copy link
Member

laryn commented Feb 12, 2024

@yorkshire-pudding Am I correct in understanding that the linked core issue will solve this when its merged? If so I may close this here just to keep the issue queue clean.

@yorkshire-pudding
Copy link

Hi @laryn. Yes, I have tested the diff from the latest PR (backdrop/backdrop#4653) against a view with BEF enabled and can confirm that the core fix will also fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants