Space key should not auto submit form

Created on 9 July 2025, 6 days ago

Problem/Motivation

When using the "Make filter options collapsible" feature of better Exposed Filters, it places the filter field in a <details> element and puts the filter label in the <summary> element. When the exposed form is set to auto-submit, focusing on the summary item and hitting space submits the form. It should just open/close the details/summary field.

The space key is a default trigger to open/close detail elements by users navigating by keyboard and should not be hi-jacked to submit the form.

Steps to reproduce

  1. Install latest version of module.
  2. Create a view
  3. Add a filter to the view and expose it to visitors
  4. Set the exposed form to be "Better Exposed Filters"
  5. Open exposed form settings
  6. Enable the "Enable auto-submit" checkbox
  7. Under the "Advanced filter options" for the filter previously added, enable the "Make filter options collapsible" option
  8. Save the view
  9. Navigate the frontend of the view
  10. Using your keyboard, move the focus to the <summary> element
  11. Click the space key
  12. The <details> element will briefly open, and the form will be submitted, which causes the form to re-render and the <details> element will be closed again.

Proposed resolution

Add the space bar key code (32) to the ignoredKeyCodes in auto_submit.js

Remaining tasks

Create MR with proposed change.

User interface changes

When focused on an element in the form, the space bar will no longer submit the form.

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

Active

Version

7.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States averagejoe3000 Swanzey, NH

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024