Needs review
Project:
Special menu items
Version:
7.x-2.0
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2012 at 23:42 UTC
Updated:
3 Jan 2020 at 02:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
a.ross commentedYes.
The best way is to change the HTML tag for "nolink" in
admin/config/system/special_menu_itemsto this:<a href="#">It would be preferable to be able to change it to this though:
<a href="javascript:void(0)">Is there any possibility of allowing this? The permission for changing the tag (Administer site configuration) is considered high enough to be able to take over a site already, so I don't think it's necessary to filter the tag for javascript. Am I correct?
Comment #2
a.ross commentedOtherwise it might be viable to simply have a set of pre-defined options in a dropdown or radio buttons, like this:
Comment #3
a.ross commentedI've actually found a much better solution, and that is to just use
<a>. And this is actually valid HTML5! So if your template is using HTML5, then this is the way to go.And if we are going for a preset list, then something like this seems sensible:
Comment #4
NecroHill commentedjust to inform that javascript:void(0) and a on double click return page 404 (urls: your-domain.xx/void(0) and your-domain.xx/undefined accordingly)
Comment #5
a.ross commentedUh, yeah, that was part of what this issue was about... Javascript is currently filtered out, that's why you get the faulty http://example.com/void(0) url.
Comment #6
mengi commentedUsing < a > for a superfish link makes the link selectable if using sf-SmallScreen and will send the user to the 404 error. Using < a href="#" > will not send the user anywhere but is still a selectable option. is the best option so far, as it is not able to be selected by the user.
Comment #7
a.ross commentedNo, <a href="#"> is not the best option, as that links to the top of the page. I don't see sf-Smallscreen in the options, but this must be a bug in that plugin. What is the URL that gives you a 404?
Comment #8
pyxio commentedgreetings,
fyi, i can confirm 404 error with Smallscreen menu. the actual url produced is www.foo.com/undefined. cheers
Comment #9
aburnsni commentedPossibly not the correct place to post, but if someone who knows better could they please sort it.
To get this working with sf-smallscreen.js:
I am using
<a href="#">(I know there are other debates about this)in sf-smallscreen.js
change the line
disable = item.is('span') ? ' disabled="disabled"' : '',to
disable = item.is('span') || item.attr('href')=='#' ? ' disabled="disabled"' : '',This causes sf-smallscreen.js to disable the link if either
<span>or<a href="#">are used.Comment #10
grincon commentedThis worked like a charm for me: HTML for "nolink" in special menu items configuration enter:
<a href="#" onclick="return false;">No need to change any code in the modules.
Comment #11
groston commentedgrincon,
Works for me as well - thank you.
Comment #12
boran commented#10 works for me too: as the title link on superfish dropdown menus on touchscreens like iphones, so that a click works like a desktop hover.
Great!
Comment #13
thomsonj commented#10 worked for me as well. Thank you!
Comment #14
volkan@bd commentedThanks a lot grincon. It works.
Comment #15
simonbcfa commentedBrilliant #10
Comment #16
Anonymous (not verified) commented#10 works ! Thanks a lot.
Comment #17
izmeez commentedAttached is a patch adding suggestion from comment #10 as the default html no-link configuration setting rather than
<span>for review and those who need it.Comment #18
a.ross commentedThis has been said 3 years ago already, but apparently people didn't get the message, so just to repeat myself:
The variant with
return false, disabling the click event on it, is ugly and hacky (doesn't always work). Also, it's only "needed" in conjunction with sf-smallscreen. And even in that case it would be better not to work around it like this, but instead to fix sf-smallscreen not to make faulty links!Comment #19
kulonlz commentedProbably worth noting, adding
<a>breaks keyboard accessibility in IE, so it's not really an option.A workaround could be
<a tabindex="0">?Comment #20
a.ross commentedTrue, it breaks keyboard focusability, and not just for IE. If you need it, taxindex should indeed work. See http://stackoverflow.com/a/14258485/1000608
Comment #21
izmeez commentedHere is a patch using tabindex. Is this the preferred way?
Comment #22
kulonlz commentedI'm thinking yes, however you may want to change the description text.
Comment #23
izmeez commentedYes, I was wondering what wording would make sense for the description but thought the change might become the new default and I'm not sure why or when span tag would be needed?
Comment #24
izmeez commentedI am wondering if this is a duplicate of #2291085: Add tabindex to nolink items will need to explore further.
Comment #25
izmeez commentedI don't think this is a duplicate of #2291085: Add tabindex to nolink items.
Comment #26
cobasa commentedSo patch #21 helps by making the menu item tabbable, but when tab browsing, I'm not able to expand the item when it's used as a parent like I can with other parent menu items. Is that a configuration issue? I'm testing for accessibility, so clicking the item is not an option.