Problem/Motivation
The links widget uses the checkbox-widget library, thus transforming the facet link to a span display.
In 2.x the link widget had its own library, this in now gone in 3.0. But still not sure whether the link widget should receive the checkbox widgets library. At least now this part in the template that marks a link active is now removed by the checkbox widget js and thus there is no default visual indication that a facet link is active (by CSS class, but not without class just in plain HTML).
The checkbox widget is now extending from the link widget, maybe that is the reason why the library is added to both. But this could probably be solved in using different implementation of appendWidgetLibrary in Link Widget and Checkbox Widget
There has been something about the link widget display in #3309612: Link widget styling. Imho this is "repairing" styling for links, which in the first place got "broken" through the checkbox widget library added to the links widget.
Steps to reproduce
Use a facet with link widget and note that if you select a facet, you will not see the
(-)
indicator known from 2.x.
Proposed resolution
Do not use the checkbox widget library on the link widget. It seems, it will work without this as well and it will look and behave more like expected and like 2.x. The changes from #3309612: Link widget styling can then be reverted too probably.
Remaining tasks
User interface changes
Back to 2.x like style and behavior for links widget
Issue fork facets-3447859
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:
Comments
Comment #3
stefan.kornComment #4
stefan.kornComment #5
stefan.kornThere is another issue if a link facet and a checkbox facet are used together. The checkbox facet js will also target links, which makes them loose styling like #3309612: Link widget styling claims. The facet checkbox js should not target links.
Comment #6
mlncn commentedRelated, possible duplicate, #3360920: Links widget is loading the checkbox widget JS library, and wow i 1,000% agree with all that have worked on both issues that links should not be converted to spans by JavaScript needlessly! In addition to all the problems mentioned, it means that a theme's link stylings are not used. This is at least major and this surprisingly simple patch fixes it all, for me. Less code, much less overhead, better functionality == win.
Comment #7
candalt commentedCan confirm that the plain diff is working fine on Drupal 10.3.10 and Facets 3.0.0.
Comment #8
s3b0un3tHello,
Unlike the other two issues mentioned, I think the fix for this one is the most elegant and comprehensive.
Tested and validated in version 3.0.0 (in Drupal 11.1.3).
THANKS !
Comment #10
ericgsmith commented+1 for RTBC - this is super important to get in and a major accessibility issue
Have closed #3508981: "List of links" not working in 3.0 as a duplicate. This is technically a duplicate of #3360920: Links widget is loading the checkbox widget JS library which is older, although the solution here is complete and RTBC'd already.
Suggest the maintainer consider closing that and assigning credit from the related issues.
MR was showing with an unreleated test failing - have rebased and showing as green now.
Comment #12
strykaizerComment #14
strykaizer