Problem/Motivation

In the Drupal 8+ core version of views the exposed numeric/date filters with multiple form elements was adjusted. That change I think should be backported to Drupal 7 version of views (or atleast a version of it).

The main issue is that when exposing a views filter on a numeric or date field the labels shown are missing except for 'And'. 'Min' is hidden and so is 'Value' when not using the range operations.

Steps to reproduce

  1. Create a view and add a exposed post date filter and check the 'Expose operator' option.
  2. Navigate to the view or use the preview on the views UI.
  3. Confirm that when the operation 'Is greater than' there is no label for the form field (no hidden label either). You can also run Wave accessibility browser extension tool to confirm that.
  4. Switch the operation to 'Is between' and confirm that the max value has the label 'And' but the min value has no label.

Proposed resolution

Copying the solution from https://www.drupal.org/project/drupal/issues/2625136, switch the labels for min and max to 'Min' and 'Max' without any checks for exposed or not.

For the 'value-value' field set the label to 'Value' but use the exposed attribute to toggle '#title_display' as being invisible or not.

Remaining tasks

  • Provide a patch. - Done
  • Add screenshots. - Done

User interface changes

Before when configuring the exposed filters

Before when configuring the exposed filters screenshot

Before when viewing the exposed filters

Before when viewing the exposed filters screenshot

After when configuring the exposed filters

After when configuring the exposed filters screenshot

After when viewing the exposed filters

After when viewing the exposed filters screenshot

Comments

dmundra created an issue. See original summary.

dmundra’s picture

Status: Needs review » Needs work

The last submitted patch, 2: views_handler_filter_numberic_label_fix-3389629-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

dmundra’s picture

StatusFileSize
new1.39 KB

Fixed a bug in the patch after test failure.