Remove href completly from a_attr

355 views
Skip to first unread message

Tom Beech

unread,
Feb 11, 2014, 7:29:49 AM2/11/14
to jst...@googlegroups.com
Having a href in my nodes is causing unwanted behaviour.

My jsTree occupies only a small part of the user screen. So there is overflow in my div. When a user clicks on a node which overflows, the jstree div is repositioned to highlight the node the user just clicked.

Removing href from the node resolves this issue. I have updated my jstree.js so that href is never created. However, i would prefer to use a better solution.

Is there anyway i can form my JSON to incidate 'do not create a href tag' ?

Thanks,
Tom

p.s. i also had to add cursor: default; to .jstree-node in style.css in order for my solution to work.

Ivan Bozhanov

unread,
Feb 11, 2014, 8:29:44 AM2/11/14
to jst...@googlegroups.com
Your problem should not be related to the HREF attribute, and even if it is - it is required by definition and can cause a multitude of problems when not in place - so basically - so not remove the the A attribute.
If you want - create a plugin and overwrite the redraw_node function to create a SPAN with jstree-node class instead of A. Just call the original function and replace the A with SPAN, that way you are safe for future versions.

Best regards,
Ivan

Tom Beech

unread,
Feb 11, 2014, 9:11:11 AM2/11/14
to jst...@googlegroups.com
My solution was not to remove the A attribute, it was to remove the HREF attribute. It has caused no apparent issues with jsTree.... could you please explain what issues I should be seeing?

Ivan Bozhanov

unread,
Feb 11, 2014, 11:25:26 AM2/11/14
to jst...@googlegroups.com
Some browsers may apply only partial CSS, you will get pointer issues and also - you might break tab order indexes and possibly screen readers. I know what you did - I am just suggesting another approach. Or you could remove the href from a plugin - the same way I described in my previous post. Or if that is too much work - bind to open_node and do: data.instance.get_node(data.node, true).find('.jstree-node').removeAttr('href')

Best regards,
Ivan
Reply all
Reply to author
Forward
0 new messages