Users want to copy text in a listbox, the current solution is "nonselectableTag".
A customer reported that he wants "to be able to select a line by clicking and also select text within the line by clicking and dragging".
2 issues with nonselectableTag:
- It's very tricky to highlight a text by dragging mouse pointer.
You must be very carefully not to release mouse outside of the text, or zk will think you do not click on a <span> then listbox will select the item and cancel the highlighting. Although double clicking can also highlight the text, but this doesn't work for text with space.
- click label cannot select the item.
So users must be aware of clicking outside of a text to select them. Although this effect is just the result when setting nonselectableTag="span", but it also causes inconvenience when selecting an item. Because users just want to copy text, this behavior looks like a side effect to enable highlighting text.
If we can distinguish dragging and clicking, we can avoid select an item when mouse dragging. For example, we use window.getSelection() to determine whether if users select a text or not.
Above code is just showing an idea. For IE, getSelection() is only supported since IE 9. Prior to IE 9, we can use document.selection(). (ref http://stackoverflow.com/questions/5421892/getselection-not-working-in-ie)