Problem/Motivation
This request is a natural follow-up of an existing D8 issue:
#3132725: "Limit list to selected items" on exposed filters does not filter
And D7 issue:
#510068: Using "Limit list to selected items" on exposed filters not working
The title and description of the checkbox: "Limit list to selected items" is not clear in that it only applies to the filter options and not the view results:
"If checked, the only items presented to the user will be the ones selected here."
A more precise checkbox description would mean less "Closed as designed" issues in the future.
Steps to reproduce
- Create/change a view;
- Add a 'filter criterion' to the view;
- Enable "Expose this filter to visitors, to allow them to change it" - the form will get expanded with additional options;
- Enable "Expose operator" (only to get a similar, other option "Limit the available operators" visible);
- Verify the text of the option "Limit list to selected items".
Proposed resolution
The title and description should be updated to clarify this.
Title: "Limit <em>filter</em> list to selected items"
Description: "If checked, the only <em>filter options</em> presented to the user will be the ones selected here. This checkbox has no effect on view results list."
And to clarify checkbox purpose completely, and to help those who need results of selected-items-only to be inside view-results-list as well - we could add some documentation words to description:
"If you need view results list to contain results of selected items only, please create additional (same, but non-exposed) filter."
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #52 | views_exposed_options-3133906-after-patch.png | 37.39 KB | johnv |
| #52 | views_exposed_options-3133906-before-patch.png | 59.75 KB | johnv |
| #52 | views_limit-items_3133906-52.patch | 1.92 KB | johnv |
| #33 | Patch#28.png | 115 KB | priyanka.sahni |
| #33 | Afterpatch#28.png | 192.76 KB | priyanka.sahni |
Issue fork drupal-3133906
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3133906-change-unclear-exposed
changes, plain diff MR !11132
Comments
Comment #2
devad commentedComment #3
devad commentedComment #4
devad commentedComment #5
devad commentedComment #6
klidifia commentedCertainly makes sense; I think it's more important to update the title to include the word filter, I've done both here.
Comment #7
klidifia commentedComment #8
kristen polThanks for the issue and patch.
Although I understand the motivation to create this issue and the patch works as expected, I'm note sure this wording change is necessary. It does make it more clear, but I'm not sure if updating the wording as suggested fixes the DX problem.
I agree with @dww here:
https://www.drupal.org/project/drupal/issues/3132725#comment-13593735
and if there is a wording change, maybe it should capture that. Something like:
I'm not sure that makes it more clear but you probably get the idea.
I did check the patch worked as expected as shown in this screenshot.
Comment #9
devad commentedThanx for patch @klidifia
I agree that changing title as well is the best option.
I didn't want to suggest title change in the beginning since it is not completely necessary if checkbox description is good enough. But for those who read titles only... yeah... title change is more important. :)
Comment #10
devad commentedRegarding patch #6 ... did you purposely omit "This checkbox has no effect on view results list." at the end of description or accidentally?
I believe these few words are important to be included at the end of description if we want to avoid future misunderstandings of this checkbox purpose completely.
Comment #11
devad commentedRegarding more elaborated description for those who need result list to be filtered as well (as suggested in #8 and original text) maybe it would be better to add "Limit list to selected items" instructions to views exposed filters documentation page and to link description to that page.
We can create a new documentation page for that purpose if above page should not be used for such detailed instructions.
Currently there is no one word of description of "Limit list to selected items" checkbox in views exposed filters documentation page.
Comment #12
kristen polIMO this should go back to "Needs work" so changing. See comment in #8.
Comment #13
kristen pol@devad Looks like we crossposted. I didn't submit a patch, I only tested the patch. I don't have strong opinions on this issue but if the issue is that people don't know that the checkbox doesn't filter the results then additional text in the description and/or the documentation is necessary IMO.
Comment #14
devad commented> I didn't submit a patch, I only tested the patch.
Yeah... we cross posted twice. I have corrected patch author promptly but not before your posts. :)
Comment #15
devad commented> if the issue is that people don't know that the checkbox doesn't filter the results
> then additional text in the description and/or the documentation is necessary
Yeah... that's the main reason for this support request. Many drupalers are confused.
Some history... The original purpose of this checkbox was to filter both filter options and view results and thats why its title and description are ambiguous as they are now. The clear and very simple bug was discovered and patched 6 years ago, but never commited because the bug morphed into feature used by many web sites as nicely explained by @David_Rothstein here.
So, fixing the bug is not an option any more... but what we can do is to adjust title and description to describe the real purpose of this checkbox unambiguously.
Comment #16
devad commentedComment #17
mrinalini9 commentedComment #18
mrinalini9 commentedUpdated patch as per the changes mentioned in #8.
Comment #19
kristen polThanks for the update. I was thinking someone might improve upon my wording. :)
Re-reading a few times, here's a slight modification:
But, I don't know if this is clear enough.
Comment #20
mrinalini9 commentedComment #21
mrinalini9 commentedUpdated patch as per the changes mentioned in #19.
Comment #22
kristen polThanks for the update.
1) Reviewed interdiff and it looks ok.
2) Tests are running so we'll wait on those.
3) Marked for manual testing.
Comment #23
devad commentedLimiting view results to selected options is not something everybody will need. So it would be nice to change wording to "If you need view results to be limited to selected options as well..."
New wording suggestion is here. I have marked all changes and additions:
If checked, the only filter options presented to the user will be the ones selected above. If you need view results to be limited to selected options as well - this filter must be required or, alternatively, an additional unexposed filter must be added to filter the results.
P.S.
For best DX, if possible, it would be nice to link words "additional unexposed filter" to Support article:
https://www.drupal.org/forum/support/post-installation/2012-02-29/limit-...
This would give developers direct link to helpful support article.
But I don't know if D8 field descriptions support html links...
Comment #24
mrinalini9 commentedHi @devad, I have updated the patch as per the changes suggested in #23, please review.
Comment #25
devad commentedThank you @mrinalini9
It looks good. Image attached. Marking as RTBC.
Comment #26
klidifia commentedSorry yes I did intentionally leave out the "This checkbox has no effect on view results list." - I hadn't thought that is necessary as the view results list is effected when the user selects the option(s) that you permit them to select based on the selected items checkboxes and the "Limit filter list to selected items" checkbox.
But looking at that link you've included in the latest patch, I understand now and agree it's a worthy inclusion :)
Comment #27
kristen polThanks for the update.
We don't link core documentation to support posts so that will need to be removed.
Also, I would replace:
as well - this filterwith
as well, this filterComment #28
mrinalini9 commentedHi @Kristen Pol, updated patch as per the changes mentioned in #27, please review.
Comment #29
devad commentedRe: #27
Sure. I had a doubt if linking to such external pages is allowed.
What about creating similar "additional unexposed filter" tutorial somewhere inside official documentation and linking to it. Is it possible?
I can volunteer to create such doc page with detailed instructions and screenshot images for beter DX. But I don't know what would be the best place to add such documentation page and if I have enough permissions to create/edit such document.
Comment #30
kristen polI don't think linking to any doc would be accepted by the core maintainers in this text change. If people are creating views, IMO they would likely know how to add an unexposed filter, especially since they are adding an exposed filter in this case.
Comment #31
devad commentedThank you for reply @Kristen Pol. I agree that this title and description should be enough.
And if not... there is alway Google search...
Tested patch #28. Looks good. Image attached. RTBC.
Thnx @mrinalini9 for all your patches and patience. :)
Comment #32
xjmThanks for working on this!
Let's request a usability review for this change, since that description is adding a lot of text and the more text there is, the less people read it. There are weekly meetings started from the
#uxchannel in Drupal Slack.Comment #33
priyanka.sahni commentedVerified and tested after applying the patch#28.It looks fine.The descriptive text would provide clarity to the users.
Steps to test-
1. Go to admin site
2. Go to /admin/structure/views/view/content
3. Verify the descriptive text appears under Limit filter list to selected items
Comment #34
xjmThanks @priyanka.sahni. As mentioned in #32, this needs a usability review. We've gone to lengths to shorten or eliminate descriptions wherever possible because it is better UX and more accessible. So setting NR until we get review from our usability team. As I suggested, one can ask about it in the
#uxchannel in Drupal Slack. There will be a meeting later today.Comment #35
devad commentedOn second thought... maybe we can make title and description a bit better and more compact with some changes:
Title: "Limit filter options..." is a bit more precise wording than "Limit filter list...". Especially if we want to make description shorter also.
Description: We could remove "If checked, the only filter options presented to the user will be the ones selected above." completely from description because there is no big reason to repeat again pretty much the same thing title is saying. Especially if we have additional points to stress inside description area.
-------------
After making the changes listed above and with few more wording improvements - the final result would be something like:
Title: "Limit filter options to items selected above"
Description: "If this filter is not required and you need view results to be limited also, please add an additional unexposed filter with same items selected."
-------------
This kind of wording could pass usability review easier I suppose - just a few words longer then current title and description, but much more straightforward and DX friendly.
Additional ideas, and wording improvements are welcome... since English is not my mother language...
Comment #36
shaalWe discussed this issue during Usability Meeting (see recording here #3150296: Drupal Usability Meeting 2020-06-16, from the beginning, conclusion at 13:00 minutes of that recording)
If I remember correctly, the last comment (#35) was what we agreed on + @webchik said she'll help fixing the wording of the sentence suggested there.
Comment #37
shaalComment #38
devad commentedThank you for discussing this topic during Usability Meetings.
Since this issue is back to "Needs work" status let me add a bit more of brainstorm to this issue.
The perfect solution for this issue could be to add one more checkbox as child checkbox below current "Limit list to selected items" checkbox. @David_Rothstein mentioned such solution here long time ago: #1309578-10: When using operator "Is one of" and "Limit list to selected items" - 'Any' should not ignore the selected items.
The title of the new checkbox could be "Limit view results to selected items also".
Ideally, the new checkbox could be Javascript hidden by default and we can make it visible only if both of these two criteria are fulfilled:
1."Limit list to selected items" checkbox is selected and
2. The exposed filter is not required ("Required" checkbox is not selected)
This would spare Developers from having to add one more filter and solve the performance issues caused by filter duplicates also.
If there are just a few items selected performance impact is not significant. But if there are many items selected - duplicate filters produce slow DB queries with many table joins. In some cases joins can grow out of allowed SQL limits (or execution time or memory limits) as described here:
#510068-26: Using "Limit list to selected items" on exposed filters not working
Adding new checkbox would be the best and the most complete DX friendly solution for this issue.
And if it is not possible or would be an overkill - we can go back to improving title and description of course.
Comment #39
kristen polI like @devad's suggestion in #38 unless there isn't a compelling reason for allowing the options to be filtered and not the results, i.e. if 99% of developers would expect that the results should be filtered when the options are filtered, then IMO it would make sense to just do it by default and not add another checkbox. Personally, I would keep the two in sync.
Could we get a sense if if either approach would be an acceptable change by the core maintainers?
Comment #40
devad commentedRe: @Kristen Pol #39
If "Limit list to selected items" checkbox is not selected then view results are filtered to selected items as expected.
If "Limit list to selected items" checkbox is selected then the view results become unfiltered suddenly.
Yes, it is a strange buggy behaviour indeed but there are backwards compatibility concerns connected with this clear typo bug.
With D8/9/10 flexibility maybe there is some handy way to "depricate" this bug in D9 and fix it properly in D10 with warnings to users that the checkbox functionality is fixed back to normal in D10 and that they should update their outdated views manually to match new functionality.
Only the views which have filter(s) which match all of the the following four criteria will need manual updates:
1. The filter is exposed
2. It is not required
3. "Limit list to selected items" checkbox is selected
4. Additional unexposed filter with same items selected is not added
Adding an additional unexposed filter with same items selected is a common developers' workaround for this bug last 10 years. So, most of the views which have first 3 criteria fulfilled have such unexposed filters added also. If such filter is not added that would mean that the user is using the checkbox's bug as a feature. Such views are easy to be recognised by update script and users can be warned that such outdated filters need to be manually updated after the D10 upgrade (or even earlier during some D9 minor upgrade if possible).
I do not expect that there will be a lot of views which will need such manual updates... if any... because to limit filter options and not to limit view results is not a common feature you need. If some users will need such a specific feature after D10 upgrade they can implement it back into their views with custom hooks.
Comment #41
kristen polDeprecating is an interesting idea but I'm not sure how it can be deprecated.
Normally with deprecation, the old method/approach is still supported while the new method/approach is in place. But in this case the old and new methods/approaches are actually *different*. Meaning, if someone *wanted* to have the options filtered but *not* the results then there isn't a way to both keep that and update the functionality to filter both options and results.
I don't see how to change it while still make it technically "backwards-compatible". So, it appears it can only be "fixed" (by filtering both the options/results) in Drupal 10 while in Drupal 9 we can only update the text.
Also, if it was fixed in Drupal 10, I don't think we should add code that notifies them that they can remove their extra filter. There can be a change record that explains it though.
Comment #42
devad commentedChanging title and description now, and fixing bug in D10 would be nice.
However, backwards compatibility after D10 upgrade will not be preserved.
If it is acceptable and adding D10 change record is enough - then straight fix would be the simplest solution.
The patch exists in D7 issue already and could be adjusted for D10 easy I suppose.
Technically... is it the last long-supported D9 version which should be fixed? Because The last D9 version and D10.0.0 should be (almost) identical... as much as I understand new versioning policy.
Comment #43
devad commentedBack to the roots of this issue...
As mentioned in #36... is it possible to assign this issue to @webchik and to commit title and description adjusting before 9.1 is out?
And for ideas introduced from #38 above we can open new issue if there is interest for further improvements before D10 is out.
Comment #44
devad commentedJust a reminder...
Is it possible to include this title and description change into D9.1?
Time is ticking... D9.1 alpha will come out in one week. :)
Comment #51
johnvComment #52
johnvAs a summary of the above discussion:
#1-#34 are about the new text proposal
#28 contains the latest text proposal
#39-#44 are about other proposal that better deserves its own issue, if still needed.
#40 expresses some thoughts about current behaviour
I tested in D11.1 the behaviour of the (exposed) filter operators and options: Whatever the limit/expose settings, the values that are set in 'Filter criterion' form, are directly applied to the view, when a user calls the view.
[EDIT: This was tested with a computed field. #3132725: "Limit list to selected items" on exposed filters does not filter shows that the filter is applied when not exposed, but not when exposed - I regard this as an error.]
Issue summary is updated to standard format.
Issue moved to views_ui.module.
Regarding the text proposal, I find the additional lines hard to understand. Or even: I do not understand them at all.
As an alternative, let us compare with the other option:
[ ] "Limit the available operators" = "Limit the available operators to be shown on the exposed filter."Then 'our' option would just be:
[ ] "Limit the available options" = "Limit the available options to be shown on the exposed filter to the ones selected above."This is what is proposed in attached patch.
Comment #55
smustgrave commentedJust FYI UI changes should include screenshots in the summary.
Comment #56
devad commentedRe: #51-#54
Thank you for trying to help. However, cosmetic change of title and description is not what this issue is meant for originally . The new description should warn users of existing bug behavior. Please read previous conversation in this issue. Comment #40 in particular (for bug information) but other comments as well.
Comment #57
smustgrave commentedyea seems like there was still some discussion going on, didn't read the comments yesterday hence never changed the status.
Comment #59
devad commentedThe #3132725: "Limit list to selected items" on exposed filters does not filter is committed.
So, I suppose that this issue can be closed as outdated now since it is not needed any more.
Comment #60
smustgrave commentedThanks for flagging, agree we can close.