Skip to content
This repository

Allow user to click on a tag in the list of suggested tags to add it #2

Closed
jasondavis opened this Issue December 30, 2011 · 11 comments

4 participants

Jason Davis Alex Gorbatchev Neville Franks Martinffx
Jason Davis

It would be nice to be able to Click on a tag once it is in the suggestion list

Neville Franks

I am very surprised that clicking on an item in the suggestion list doesn't select it. This seems like the most basic of desired behaviour.

Alex Gorbatchev

I agree, seems that I have overlooked this one.

Neville Franks

Any idea when you'll implement mouse click selection?

Jason Davis

jquery-textext is really an amazing project you got here, I mean I would rate it with the tagging ability of Stackoverflow and Facebook on the feature side of it, the only thing missing for me is the click ability, thanks for sharing your work with the world

Alex Gorbatchev

@jasondavis thnx!

Not sure when exactly I'd be able to get to it. It would be awesome if you guys could take a look at it :)

Jason Davis

I would love to contribute but I am more of a backend coder, I am not currently skilled enough with Javascript. I did take a look at the code though just to get an idea, and in Autocomplete plugin I found this

p.onClick = function(e)
{
    var self   = this,
        target = $(e.target)
        ;

    if(target.is(CSS_DOT_SUGGESTION))
        self.selectFromDropdown();
};

I would imagine that is for doing what this question was about but since it does not do it, maybe this is for a different click event?

Jason Davis

An update, I have found how out more information.

Here is an image that is more to the point of the problem... You have to click in the area highlighted with red for it to work as expected. So if you click anywhere outside of that red box it will not work, including on the actual text/name of the tag

click area

The ideal solution would allow you to click anywhere in the GREEN highlighted section to add that tag to the input box.

click area

If you watch this 2 minute video you can see, I am on Windows 7 with Chrome http://screencastle.com/watch/00ca12cc4d3e10de867b8404007f85a4

Adam Ayres adamayres referenced this issue from a commit in adamayres/jquery-textext January 15, 2012
Adam Ayres Fixes #2 #4 #5 - Capture mousedown event in autocomplete used by the …
…blur event to determine if it was triggered by a scroll click or an item selection, in which case we set focus back to the input instead of closing the autocomplete. Added a click listener to the document body that triggers the autocomplete to close when the click is not within the textext wrap element.
f312b04
Prateek Dayal prateekdayal referenced this issue from a commit in prateekdayal/jquery-textext January 16, 2012
Adam Ayres Fixes #2 #4 #5 - Capture mousedown event in autocomplete used by the …
…blur event to determine if it was triggered by a scroll click or an item selection, in which case we set focus back to the input instead of closing the autocomplete. Added a click listener to the document body that triggers the autocomplete to close when the click is not within the textext wrap element.
044f6a9
Martinffx

Any chance of merging one of these fixes into the main project

Alex Gorbatchev

Will merge it this weekend. Sorry about delay on this.

Alex Gorbatchev

Thank you!

Alex Gorbatchev

Merged.

Alex Gorbatchev alexgorbatchev closed this February 19, 2012
zhouyanming quaff referenced this issue from a commit March 31, 2012
zhouyanming Improve Issue #2
allow user click item for adding it when autocomplete custom render return html not simple text

for example,if json is not string array,but a tuple array:
[{"label":"label for value1","value":"value1"},{"label":"label for value2","value":"value2"}]

render : function(suggestion) {
if (typeof suggestion == 'string') {
return suggestion;
} else {
if (!suggestion.label)
return suggestion.value;
else
return '<div value="' + suggestion.value + '">'+ suggestion.label + '</div>';
}
}
40aedca
Benjamin Arthur Lupton balupton referenced this issue from a commit in BugHerd/jquery-textext July 24, 2012
Benjamin Arthur Lupton Fixes #41, #53, #2, #28 - Suggestions aren't clickable when autocompl…
…ete is manually shown

Problem is that the click event does not fire for some reason, however
the mouseup event does. Likely browser lacking support, or the click
event is cancelled by a bubbling event. However, this fixes the issue.
8ed53fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.