Problem/Motivation

To reproduce:

  1. Edit "Content" view
  2. Add a filter on "Authored on" field
  3. Expose it
  4. Select "is between" operator
  5. Save view

Expected behaviour:
Newly created filter is displayed with a label and two text-fields that allow user to define range to filter on.

Actual behaviour
The two text-fields are displayed without label.

This bug is specially annoying when you have more than one such filter as it is very hard to distinguish between them.

D7 handles this on a template level, which was removed in D8.

#2455961: Exposed filter of Changed displays with label of Operator is most likely result of the same problem.

Proposed resolution

I see two potential solutions for this problem:

  1. Re-introduce template for views_exposed_form (which will also fix #2455961: Exposed filter of Changed displays with label of Operator)
  2. Make sure label appears in exposed form render array in a correct form

Remaining tasks

- agree on approach
- write patch
- write test

User interface changes

- labels are correctly displayed with exposed filters

API changes

n/a

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slashrsm’s picture

Issue summary: View changes
dawehner’s picture

Mh, that template was always really confusing for the themer, it would be great to avoid that, if possible.

Make sure label appears in exposed form render array in a correct form

That seems to be the better solution I think. I guess we "just" need to tweak the labels which are defined in core/modules/views/src/Plugin/views/filter/NumericFilter.php:206?

slashrsm’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
622 bytes
738 bytes
59.31 KB
68.26 KB
60.36 KB

This is how range exposed filters look at the moment:

I think we have two possible solutions for this issue:

  1. We make sure title is properly displayed above first form element. This is how D7 Views are done. 2483905_1_title.patch implements this approach.

  2. We could also wrap everything in a fieldset. This would also be useful in cases where we expose operator too. This approach changes general look and feel of exposed filters. 2483905_1_fieldset.patch implements this approach.

slashrsm’s picture

Discussed this on IRC with @dawehner and we both agreed first option is probably the way to go. Would be nice to get some feedback from @bojhan about grouping of filters though.

slashrsm’s picture

Added test.

Status: Needs review » Needs work

The last submitted patch, 5: 2483905_5_TEST_ONLY.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review

Expected result.

Primsi’s picture

Issue tags: +d8ux

The patch by itself looks ok. Tagging with something UX related, although I don't know if that's the right tag.

chandru225’s picture

Status: Needs review » Needs work
Issue tags: -d8ux +#DCB2015
FileSize
30.89 KB

The Ux for this issue is still breaking and i don't see a option yo select "between range" option.

anavarre queued 5: 2483905_5.patch for re-testing.

Lendude’s picture

duplicate of #2480719: Missing label and description for exposed numeric filter when using 'between' filter, fix and tests are similar. Other issue is RTBC so probably best to just stick with that one.

apaderno’s picture

Issue tags: -#DCB2015