Bug: Superfish redirects to page "/undefined"
Scenerio is as follows:
- Enable module special_menu_items. Create a 'placeholder' menu item
- Enable sf-Touchscreen plug-in (unconditionally)
- Click twice on the placeholder menu item.
- Superfish redirects to page "/undefined"
Solved by the simple patch below - for the superfish library. I've not posted it as a patch here because I presume that wouldn't work for the library which lives in github. Looking at the code for the dev version of the library, the same problem exists in dev too.
$ diff -rup orig.sftouchscreen.js new.sftouchscreen.js
--- orig.sftouchscreen.js 2014-06-26 14:36:12.669863000 +0100
+++ new.sftouchscreen.js 2014-06-26 14:35:11.392955400 +0100
@@ -28,7 +28,10 @@
item.click(function(event){
// Already clicked? proceed to the URL.
if (item.hasClass('sf-clicked')){
- window.location = item.attr('href');
+ url = item.attr('href');
+ if (typeof(url) != "undefined"){
+ window.location = url;
+ }
}
// Prevent it otherwise.
else {
Comments
Comment #1
GiorgosKI ended up calling
on ready and on resize
but the underlying issue needs to be resolved
Comment #2
AdamPS CreditAttribution: AdamPS commented@GiorgosK Please excuse me setting the title back - but my main symptom was "page undefined" so I think it does help people find this issue to keep that in the title.
In newer releases the bug exists, but is harder to hit - only if you configure "Select a behaviour" as "Opening the parent menu item link on the second tap" which is no longer the default.
A similar bug occurs from sf-smallscreen, but only if "Select a reaction" is "Convert the menu to a
element", which again is no longer the default.
I have created a pull request on git-hub.
Comment #3
npoku CreditAttribution: npoku commented@AdamPS and @GiorgosK thanks for your fixes. It solved the original problem for the Superfish module, but I did run into conflicts with your fixes, because the same Superfish library is also being utilized by the Responsive Menu module.
The solution that worked for me was to apply the patch suggested here:
nolink - Compatibility with Superfish Menu
Comment #4
mehrpadin CreditAttribution: mehrpadin commentedHey there,
Could someone please update this issue, thank you.
Comment #5
AdamPS CreditAttribution: AdamPS commentedIt looks like you merged my GitHub PR back in 2017, but there still hasn't been a new release of 1.x.
So if you make a 1.1 release of the library then this bug is fixed.
Thanks!