Closed
Bug 1092559
Opened 10 years ago
Closed 10 years ago
Searching for a contact name shows the surname multiple times in the result
Categories
(Firefox OS Graveyard :: Gaia::Contacts, defect)
Firefox OS Graveyard
Gaia::Contacts
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1088706
People
(Reporter: pedro.cambra, Unassigned, Mentored, NeedInfo)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:36.0) Gecko/20100101 Firefox/36.0 Build ID: 20141031061804 Steps to reproduce: * Create a contact * Search for the contact Actual results: The surname of the contact highlighted appears multiple times Expected results: No duplication should occur
Reporter | ||
Updated•10 years ago
|
Mentor: francisco
Reporter | ||
Comment 1•10 years ago
|
||
Working on this, no clue how to assign a bug to myself
Reporter | ||
Comment 2•10 years ago
|
||
I'll keep digging into this but leaving my findings here, the issue apparently is with the highlight part of the shared search.js: newTerms.forEach(function replaceWithHighlight(term) { textNode.firstChild.innerHTML = textNode.textContent.replace( new RegExp('(' + term + ')', 'gi'), '<span class="' + highlightClass + '">$1</span>'); }); This code, when the search is not ordered by last name (orderByLastName is false) produces a html output that repeats the last name as many times as number of chars introduced and besides, the original last name (not highlighted) remains there.
Reporter | ||
Comment 3•10 years ago
|
||
I've seen a change without bug, not sure what's the context: "Search results highlighting does not work properly with special chars like accents" 5b59a3e and I think accents are still not highlighted, probably it's a separate bug, I'm pushing a fix for the duplication in this one.
Reporter | ||
Comment 4•10 years ago
|
||
Attachment #8515596 -
Flags: review?(francisco)
Tested the patch attached to the ticket. It does remove duplicate appends but it was missing the strong text in the contact name. Here is a duplicate bug that has a similar fix without losing strong text https://bugzilla.mozilla.org/show_bug.cgi?id=1092589
Hey Pedro, Thanks for making me a collaborator to ur repo. I've pushed a fix to the branch "1092559_duplicate_name_search" Kind regards, Phani.
I've pushed a another commit that will avoid replacing html tags var text = "<strong>Chuck</strong> Norris"; var term = "chuck" var highlightClass = "highlight" function addHighlightClass(p1, p2) { return ((p2 == undefined) || p2 == '') ? p1 : '<span class=' + highlightClass + '>' + p1 + '</span>'; } var term = "chuck" var result = text.replace(new RegExp('<[^>]+>|(' + term + ')', 'gi'), addHighlightClass); console.log(result); var term = "strong" var result = text.replace(new RegExp('<[^>]+>|(' + term + ')', 'gi'), addHighlightClass); console.log(result); Kind regards, Phani.
Comment 9•10 years ago
|
||
Comment on attachment 8515596 [details] [review] Replace should not replace the first child only Just left a tiny comment, could you update the pull request. Also could you squash all the commits in a single commit?
Flags: needinfo?(pedro.cambra)
Attachment #8515596 -
Flags: review?(francisco) → review+
Updated•10 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 12•10 years ago
|
||
That is being fixed by bug 1088706
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•