- Issue created by @mkindred
- Status changed to Needs review
about 1 year ago 10:17am 13 February 2024 - 🇮🇪Ireland markconroy
I'm not sure exactly why we need to disable the checkboxes when we are creating checkboxes from links for facets, so I created this small patch to remove the disabling of the checkboxes and it seems to fix the back button issue.
- 🇺🇸United States mkindred
@markconroy I like disabling them after selecting one to give the user feedback and prevent clicking on a second facet prior to loading the new page. I've shopped on quite a few ecommerce sites where the subsequent page was slow to load, and without feedback I thought I might have missed the facet link.
- 🇮🇪Ireland markconroy
and prevent clicking on a second facet prior to loading the new page.
^ That's a good point.
- 🇫🇷France AimadBachar
Hello,
The patch stop-disabling-checkboxes-3416333-4.patch works, I can now use the facets after using the back button on my web browser.
Thanks - 🇨🇦Canada jmoruzi Brantford, ON
The following applies to both 2.0.8 (patched or un-patched) and 3.0.0-beta1
Neither of these patches has any affect for me. I tested each patch individually on v2.0.8, as well as together, and in all 3 situations I see the same behaviour as if no patches are installed. In all browsers facets work as expected as long as you do not touch the back button.
There is no change in behaviour in Firefox, and there are issues in Chromium browsers as well.
In Firefox:
- I select a facet and results are filtered properly.
- Select a second facet and results are filtered properly.
- Click the back button, and the previous page loads with the results from the first facet, which is the desired behaviour, but both facets are still selected, and disabled
- Click the back button again, and only the first facet is selected, but disabled
Even if I click the back button again to go to the previous page that has filtered results, and then select the forward button to go to the page with the faceted results, the facets are still disabled until I reload the page.
Chrome, Edge and Brave:
There are no issues with the facets being disabled, but they are not activated properly once you use the back button.
- Select a facet and results are filtered
- Select a second facet, and results are filtered
- Uncheck the first facet and results are filtered properly
- Click the back button, you're taken back to the previous page, but the facet that was deselected in step 3 is still unchecked, so there is a disconnect between the selected facets and the results shown on the page. You're seeing the result of facet 1 and 2 being selected, but only facet 2 is checked.
- Uncheck facet 2, the page reloads, and now the first facet is checked. The results on the page are filtered properly.
- Click the back button. No facets are checked, but the results are filtered on the first and second facets.
This may be the same behaviour you would see in Firefox, but since the facets are disabled after clicking the back button there's no way to know.
- 🇳🇱Netherlands Drumanuel
I'm having the same problem (also in Chrome).
Instead of removing the disableFacet function, I went for a change to the unload function.
What I found is that onunload is triggered in Firefox (and Chrome) after pressing the browser's back button, while onbeforeunload is not.
I could have used the solution discussed here, using both onunload and onbeforeunload, but I'm not sure why this would be better than the solution in the attached patch.
https://stackoverflow.com/questions/6895564/difference-between-onbeforeu... I realize it's meant for 3.0.x, but drumanuel's stop-disabling-checkboxes-3416333-5.patch seems to work great with our site using Facets 2.0.9, resolving the issue in both Chrome and Firefox.
- 🇧🇾Belarus dewalt
The problem was already tried to be solved in #3210353 issue, relating it.
- 🇧🇾Belarus dewalt
Looks like #2658678 issue was solved with checkbox disabling functionality.
- 🇺🇸United States mkindred
I haven't had a chance to review all this lately, but since #3210353 was committed to the 2.0 branch 2+ years ago, and people were still having this issue described above as recently as last week, the fix doesn't seem to have solved it.
I don't understand how #2658678 is related to this issue.
If I have the time soon, I'll try to recreate the issue in a new install and record it.
- 🇧🇾Belarus dewalt
Checking proposed solutions I've found:
1. None of them work in Safari.
2. The window.unload event is deprecated (https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event), and window.onbeforeunload fires too early. When adding 'sleep(3)' to the index.php, I observed that the checkboxes become enabled again, allowing me to click them once more.
3. If checkboxes aren't disabled at all, it leads to #2658678 behaviour. - 🇧🇾Belarus dewalt
I propose to use "pageshow" event, it is fired just after a page load and has "persisted" property to check if the page is rendering from cache. Also I propose to re-render checkboxes for a full sync of its state to the related link, which avoids both issues with disabled and checked states. Please try the patch.
- 🇧🇾Belarus dewalt
Sorry, I've put early version of the patch in #16, please use this for 3.x