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

GiorgosK’s picture

Title: Page "undefined" when also using module "Special menu items" » integrate with "Special menu items" <nolink>

I ended up calling

	function fix_superfish(){
		$(".block--superfish select option").each(function() {
			if($(this).val() == "undefined")
				$(this).val("#");
		});    
	}

on ready and on resize
but the underlying issue needs to be resolved

AdamPS’s picture

Title: integrate with "Special menu items" <nolink> » Page "undefined" when using module "Special menu items" <nolink>
Version: 7.x-1.9 » 7.x-2.0
Status: Active » Needs review

@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.

npoku’s picture

@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

mehrpadin’s picture

Hey there,

Could someone please update this issue, thank you.

AdamPS’s picture

It 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!