Inspired in part by the work of adaven in this issue, I have finally, finally figured out a way to add clickable icons that

- validate
- aren't too tiny to click
- only react to clicking if the actual icon is clicked.

Yes, D7 already has "clickable icons", but they fail on the latter two points; in fact one of the greatest expected source of RTFM-bug-reports is that a click anywhere in the "li" element will trigger the toggle. This feature will add an invisible link to the left (will require RTL support, mind) as well as transform the thus-affected bullet icons from unobstrusive triangles into folders. The folders (see screenshot) are part of the Lullabot set, which hopefully means that they can be bundled in CVS.

Stay tuned for a D7 patch.

Comments

cburschka’s picture

StatusFileSize
new9.04 KB
new5.03 KB

This patch also reverses the design change to attach events to "li" elements rather than anchors. It does away with a lot of event bubbling and weird code. The "bullet" feature already existed in the settings page and has just been fixed to work better.

Along with changing the CSS and JS files, this patch requires a new "images" sub-folder to be created with the following two files:

http://www.lullabot.com/files/icons/lullacons_pack1/folder-closed-white.png
http://www.lullabot.com/files/icons/lullacons_pack1/folder-open-white.png

Images can not be included in a patch, so anyone wishing to test this feature has to do that manuallly.

Also, here is the promised screenshot.

cburschka’s picture

Status: Active » Needs review
cburschka’s picture

StatusFileSize
new6.81 KB

I installed an Arabic site and added an RTL stylesheet. The layout seems fairly straightforward.

I expect a lot of trouble with different themes and different margins though. The CSS essentially has to make a wild guess where the list-style icon is going to end up, so it can position the invisible link directly over it. I may end up having to hard-code the bullet icon margins.

Having for nbsp entities to make the invisible link pretty much 12px wide also seems naive. This will require advice from a CSS guru.

cburschka’s picture

StatusFileSize
new13.95 KB

And here is a zipped copy of the module with the new images, to make it easier to test.

cburschka’s picture

Status: Needs review » Needs work

I have now failed to attract assistance from several channels. Fortunately, I have a few ideas how to make the margins/width more robust, and I'll try them out before soliciting for more tests.

However, my schedule for getting this milestone (alpha3) ready is June 9, so by then I will either have a known bug report I haven't solved, or the change will be in HEAD (which is, after all, still unstable) where it will hopefully get more attention. :)

cburschka’s picture

Status: Needs work » Needs review
StatusFileSize
new6.63 KB

Goes to show that you can always improve on your first version.

This one completely does away with static margins and positions, and instead shifts the overlay dynamically by the exact amount needed (querying the CSS values from JS). The Javascript becomes a bit more complex, but I've taken care to add good comments. Tested on English and Arabic (RTL) - the RTL code is a bit trickier as the overlay must be shifted to the other side of the text link, requiring an individual shift for each single menu item, but it works perfectly.

Also, the ugly nbsp stuff is gone. Instead of using a display:inline link padded to the right width with nbsp, I now have a float:left display:block link set to the exact dimensions of the icon image.

The CSS code has a background:blue;opacity:0.3 rule that helps visualize exactly how the overlay covers the icon image. This is debug code which must be removed later.

I may end up pushing this patch back in favor of more straight-forward improvements, however, seeing as it is more complex than I expected. alpha3 will be out on Tuesday, but this patch might not be in it.

(Remember that this patch doesn't include the "images/" directory mentioned above.)

cburschka’s picture

StatusFileSize
new678 bytes

Here is the zipped image folder for convenience.

cburschka’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new9 KB

Fixed some minor commenting styles and pixel offsets and removed the debug code, but nothing of substance changed.

This goes in now.

cburschka’s picture

Status: Reviewed & tested by the community » Fixed

The greatest feature to happen to this module this year has just landed!

Will release alpha3 shortly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.