Once a value has been selected in the dropdown, it is not possible to de-select it.

Once a value has been selected in the dropdown it shows up as text on the button and as the only item in the dropdown.
It is not possible to de-select it or to reset the facet except by re-loading the page, thereby loosing all other values chosen in other facets on a page with faceted search.

One option would be to add an item in the dropdown with something like "Undo" - something like the reverse to the "Choose" before a value was choosen.
Another option would be a checkbox that can be un-ticked, similar to the display of "Links with checkboxes". This option would provide the same user experience as the links with checkboxes, for example on a faceted search page, where the user gets a combination of dropdown (for example for choosing a country out of a long list) and checkboxes for other values.

Only local images are allowed.

Comments

jcam88’s picture

Same issue here. No way to unselect. An alternative is to provide an "all" option that resets the filter.

erikwebb’s picture

Status: Active » Needs review
StatusFileSize
new2.95 KB
rooby’s picture

This issue seems related: #2118323: Add default option when facet is active

I won't close either of them as I don't know for sure but it seems a lot of work has gone on in that other issue.

danepowell’s picture

StatusFileSize
new3.07 KB
new412 bytes

Think the patch in #2 forgot to update one variable. Fixed here.

irowboat’s picture

#4 seems to work! Nice job.

rcodina’s picture

Status: Needs review » Reviewed & tested by the community

Patch on #4 works for me too!

mvwensen’s picture

Patch #4 seems to work for me!

maxplus’s picture

Thanks,

#4 works great for me!

jackbravo’s picture

StatusFileSize
new3.09 KB

#4 works great for us too, but we wanted to be able to use HTML inside the link so we could use stuff like fontawesome. So we have an updated patch with just one line change adding 'html' => TRUE to the $options array.

rooby’s picture

I think it would be better to have the whole link markup themeable.

Something along these lines (I have left out theme function params, this is just to illustrate what I mean):

<?php
  $form['deactivate_link'] = array(
    '#theme' => 'facetapi_select_deactivate_link',
  );
?>

Then implement theme_facetapi_select_deactivate_link().

That way you can override the markup.
Otherwise there is still a portion of the markup that is not really overridable except in theory via form alter, however then you would run into #2136831: Use drupal_get_form() when retrieving the select options form

maxplus’s picture

Hi,

I was looking for the origin of the (-), because I wanted it to change to something more readable, like reset or something similar.

For anyone who also want to change this reset link, is is found inside the facetapi module, inside facetapi.theme.inc

function theme_facetapi_deactivate_widget($variables) {
return '(-)';
}

danepowell’s picture

StatusFileSize
new3.48 KB
new316 bytes

Patch in #9 was malformed, here it is corrected.

StevenWill’s picture

Tested patch #12 and it works.

bisonbleu’s picture

Patch in #12 works for me. Thanks all!

grndlvl’s picture

Status: Reviewed & tested by the community » Needs work

Doesn't account for facets that can have multiple selections.

Example: Tags

Node 1: apple, oranges
Node 2: apple

When filtering by apple we see the two nodes as appropriate and can reset from this state as expected, however, when we also filter by apple & oranges the (-) only undoes the latest which can be confusing as the user has no idea which facet is being "Reset".

grndlvl’s picture

Status: Needs work » Needs review
StatusFileSize
new7.85 KB
new4.96 KB

Ok, to remedy the issue I mentioned above I expanded on the active items list. Instead of adding just (-) above the select. I went head and made a list of active items, much like the list facet.

Thoughts?

See screenshot: https://www.drupal.org/files/issues/Selection_012_0.jpg

  • grndlvl committed b643e42 on 7.x-1.x
    Issue #2336857 by Dane Powell, grndlvl, jackbravo, erikwebb, rooby,...
grndlvl’s picture

Status: Needs review » Closed (fixed)
EsmeraldaUBM’s picture

StatusFileSize
new58.09 KB
EsmeraldaUBM’s picture

Anonymous’s picture

StatusFileSize
new58.09 KB

Hello there!

I was looking at moving to the latest dev version and when I was testing it out I had originally patched it with patch #5 on https://www.drupal.org/node/2118323 but I noticed that it was closed out in favor of using this fix. To me it seems odd to fix this by having a reset link with a (-) attached when the whole point of having a select list is to avoid having links. Wouldn't it be better to have an option within the list that is "- Reset -" or "- Show all -" that will reset the list which is what that other patch accomplished. I think it would look more cohesive both if you have it styled vertically within a column or horizontally in which case you would want to avoid having a floating link above the select list.

Something similar to the image below where it is part of the select list would look much more cohesive:

facet

grndlvl’s picture

Status: Closed (fixed) » Needs work

Hmm, good point. Though, we should account for items that are hierarchical.

States that would need to be covered.

* Hierarchy with children using AND/OR (not-expanded -- children are revealed when the parent is selected)
* Hierarchy with children using AND/OR (expanded)
* Non-hierarchical AND/OR

The "- Show all -" I believe is something we'll want to make configurable as a reset all item that is added to the list when set.

I'll try to upload some possible ideas of how these would look using a select only approach.

grndlvl’s picture

StatusFileSize
new35.18 KB

How about this? facet selects

Where the bolded items are the selected items. We'd probably want a better way to denote that they are selected+deselectable.

grndlvl’s picture

Status: Needs work » Postponed (maintainer needs more info)

After spending some some more time on this I am drawing a blank on how to accomplish this.

The issue being that the reset URL is duplicated for the options. This works with the links since it's well links and has children. Open to suggestions here.

jody lynn’s picture

I think the UI in #21 is ideal. It's less important to allow deselecting specific items here than it is to keep the UI simple (which is the whole purpose of the module). So I think what we should do is when you choose the 'Default option label' from the select that it resets any and all selections on its facet. In the case where someone needs to deselect one item (like in a hierarchy), they will have to deselect the whole facet and then drill back down. If that's a big problem for someone then they may want to use facetapi_multiselect instead.

grndlvl’s picture

StatusFileSize
new10.63 KB

After much head and wall action I have given up on the hierarchical solutions. If anyone is searching for such features checkout Facetapi Multiselect. With that I have cut this down to only support single tier terms and dates. I have also fixed #2619960: [UX] Keep single select value if Facet is configured as "Limit to one active item" as a result of this work.

I have done away with the deselect links completely.

markandrewsutton’s picture

Patch in #26 works as expected and was very helpful for my case. Thank You!

grndlvl’s picture

StatusFileSize
new0 bytes

Made a minor change so that when the option "Limit to one active item" so that the "( - )" doesn't show up next to the selected item since only one active item can show.

  • grndlvl committed 9446057 on 7.x-1.x
    Issue #2336857 by grndlvl, Dane Powell, erikwebb, jackbravo, Earthfox411...
grndlvl’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
grndlvl’s picture

StatusFileSize
new11.21 KB

Heh here is the actual patch.

Chipie’s picture

Issue summary: View changes

Currently the user has to to click on the Reset Label first if he wants to select another value.

Would it be also possible to display all values, so you chose another value without reseting the filter first, so it should look like the image in #26:

select

grndlvl’s picture

Chipie,

Could you describe how to setup this situation? During my testing this certainly was not the case.

Chipie’s picture

Issue summary: View changes
StatusFileSize
new13.33 KB
new9.02 KB

@grndlvl,

the initial dropdown looks like this:

initial_dropdown.png

after selecting one option (e.g. "Leaders"), the other vales are not shown any more:

drodown_selected

In order to choose another option, the user has to click on the rest option label ("Alle") first, before he can chose another option.

If the dropdown looks like this

CurrentFacetReset.png

the user would be able to chose another option, without having to reset the filter first.

grndlvl’s picture

I believe this is a configuration error. I am pretty sure you need to set it as "OR" instead of "AND" and you should be good. I will double check this when I get a chance.

Chipie’s picture

You are correct. After setting the operator from AND to OR, I am getting the display, I wanted to have.
Thank you so much for your help.

grndlvl’s picture

Good to hear. Thanks for testing and the feedback.

twod’s picture

Status: Closed (fixed) » Needs work

This change completely broke the widget for hierarchies. It's no longer possible to select any term below the first level as they are never shown.

We have a short and pretty shallow vocabulary to show so we want all terms to be shown all the time, but we can only get that if we flatten the hierarchy, which looks really confusing.

  1. +++ b/plugins/facetapi/FacetapiSelectDropdowns.inc
    @@ -44,33 +54,27 @@ class FacetapiSelectDropdowns extends FacetapiWidgetLinks {
    -        $variables['options'][$url] = $this->buildSelectOption($item);
    -      }
    -
    -      if ($this->shouldExpandChildren($is_active, $item)) {
    -        $this->appendChildren($variables, $item, $depth, $is_active);
    +        $variables['options'][$url] = $this->buildSelectOption($item, $facet_settings->settings);
           }
         }
    

    Why was this appendChildren() call and the entire shouldExpandChildren() logic removed? It appears completely irrelevant to the original bug report.

  2. +++ b/plugins/facetapi/FacetapiSelectDropdowns.inc
    @@ -44,33 +54,27 @@ class FacetapiSelectDropdowns extends FacetapiWidgetLinks {
    +    if ($item['#active'] && count($variables['options']) === 1 && !empty($item['#item_children'])) {
    

    This part makes no sense ($item can be undefined here).

twod’s picture

Status: Needs work » Needs review
StatusFileSize
new2.36 KB

Here's a patch which restores the hierarchy.

grndlvl’s picture

Status: Needs review » Closed (fixed)

@TwoD The hierarchy causes more issues that it solves. If you would like to discuss hierarchy please create a new ticket otherwise you may use https://www.drupal.org/project/facetapi_multiselect

twod’s picture

@grndlvl, seriously? That module is overly complicated and completely breaks hierarchies. It turns the parent terms into optgroups, making them unselectable and thus the whole widget becomes pointless because it does not actually let me pick from all available terms.

I brought it up here because this issue introduced a major regression in functionality without a word about intending to do so...

grndlvl’s picture

@TwoD this module never was released with the hierarchy in it and was something we were looking to add, but after much aggravation to actually have it work as expected decided against it. If you would like to add this feature back properly let's open a ticket to do so.

I am also on IRC if you would like to discuss further.

Thanks.

grndlvl’s picture

Issue summary: View changes