Search with ignore keys on focus, without match highlighting.
draft
Search with ignore keys on focus, without match highlighting.
MozReview-Commit-ID: 8vRH7gURFJ5
--- a/toolkit/modules/SelectParentHelper.jsm
+++ b/toolkit/modules/SelectParentHelper.jsm
@@ -226,20 +226,17 @@ function populateChildren(menulist, opti
searchbox.setAttribute("type", "search");
searchbox.addEventListener("input", onSearchInput);
element.insertBefore(searchbox, element.childNodes[0]);
}
}
function onSearchInput(){
- let doc = this.ownerDocument;
- let win = doc.defaultView;
- let selection = doc.defaultView.getSelection();
- selection.removeAllRanges();
+
let searchObj = this;
// Get input from search field, set to all lower case for comparison
let input = searchObj.value.toLowerCase();
// Get all items in dropdown (could be options or optgroups)
let menupopup = searchObj.parentElement;
let menuItems = menupopup.querySelectorAll("menuitem, menucaption");
@@ -276,29 +273,16 @@ function onSearchInput(){
}
prevCaption = null;
allHidden = true;
}
if(itemLabel.includes(input) || itemTooltip.includes(input)){
currentItem.setAttribute("hidden", "false");
- // Set range and selection for character match underlining
- let start = itemLabel.indexOf(input);
- if(start!=-1){
- // Assumes label is first child, not the case in OSX!
- let label = currentItem.boxObject.firstChild;
- let textNode = label.firstChild;
- let range = new win.Range();
- range.setStart(textNode, start);
- range.setEnd(textNode, (start+input.length));
- let selection = doc.defaultView.getSelection();
- selection.addRange(range);
- }
-
allHidden = false;
} else{
currentItem.setAttribute("hidden", "true");
}
}
}
if(prevCaption!=null && allHidden){