Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
\Drupal\views\Plugin\views\filter\NumericFilter
does not set a label or description for the 'minimum' filter element if the filter is exposed and using the 'between' filter.
Before
After #3
Proposed resolution
Display the exposed filter label as Views did in Drupal 7.
Remaining tasks
None.
User interface changes
Add the label like it was used in Drupal 7.
API changes
None.
Beta phase evaluation
Issue category | Bug because form elements miss titles (accessibility) |
---|---|
Issue priority | Minor because the bug is a regression, but does not break behavior or destroy data. |
Comment | File | Size | Author |
---|---|---|---|
#12 | 2480719-12.patch | 2.48 KB | Lendude |
#12 | interdiff-2480719-10-12.txt | 878 bytes | Lendude |
#10 | 2480719-10.patch | 2.5 KB | Lendude |
#10 | interdiff-2480719-8-10.txt | 996 bytes | Lendude |
#8 | 2480719-8.patch | 2.5 KB | Lendude |
Comments
Comment #1
XanoComment #2
andypostComment #3
aerozeppelin CreditAttribution: aerozeppelin commentedAdded tests as mentioned in #2.
Comment #4
LendudeLooks good. Manually tested it, added screenshots.
Comment #5
LendudeShould we add 'between' after this or just leave it to the site builder to do so. Adding between would leave you with a sensible default when people don't change the label. And since you are stuck with 'And' as the label for the max field so adding more hardcoded labels might not be that bad. Just a thought...
Comment #6
LendudeMight as well fix that the description is not shown either when using the 'between' filter. Fix and test for that. Bit of a scope creep, but fits in so nicely with the other fix.
Comment #7
dawehnerIt seems to be that we should not just the existence of the strings on the page but better also some css selectors. In general this test is about the exposed filter labels, so I don't get why we need to check for the actual view result using Paul, Ringe, George etc.
Comment #8
Lendude@dawehner so maybe something like this?
Seems like the Beatles names test are there to check the proper working of the filter, those asserts are also done for the other filter settings in the same test. But since there is test coverage for the proper working of the filter in Drupal\views\Tests\Handler\FilterNumericTest that seems redundant.
Comment #9
dawehnerIMHO we should really use
cssSelect()
instead. The test should not bind everything to the rendered HTML.Comment #10
LendudeChanges per #9 to check for css selector and not the whole HTML with all the spaces and stuff.
Comment #11
dawehnerWhy do you not look into the result of cssSelect? The description is in there ...
Comment #12
LendudeYeah the description is there but still with all the extra whitespace characters, so needed to trim() it to make it ok (and not add all the whitespace crap to the test).
Comment #13
dawehnerThank you for doing that though!
Comment #14
alexpottCommitted 63c3cac and pushed to 8.0.x and 8.1.x. Thanks!