Bug 1803657 - Save to Pocket sort tag picket datalist by character input. r=gvn

Differential Revision: https://phabricator.services.mozilla.com/D163637
This commit is contained in:
scott
2022-12-06 18:12:15 +00:00
parent 2f424176f2
commit b4222b2757
2 changed files with 6 additions and 4 deletions

View File

@@ -138,9 +138,11 @@ function TagPicker(props) {
maxlength="25"
/>
<datalist id="tag-list">
{usedTags.map(item => (
<option key={item} value={item} />
))}
{usedTags
.sort((a, b) => a.search(inputValue) - b.search(inputValue))
.map(item => (
<option key={item} value={item} />
))}
</datalist>
<button
className="stp_tag_picker_button"

View File

@@ -708,7 +708,7 @@ function TagPicker(props) {
maxlength: "25"
}), /*#__PURE__*/react.createElement("datalist", {
id: "tag-list"
}, usedTags.map(item => /*#__PURE__*/react.createElement("option", {
}, usedTags.sort((a, b) => a.search(inputValue) - b.search(inputValue)).map(item => /*#__PURE__*/react.createElement("option", {
key: item,
value: item
}))), /*#__PURE__*/react.createElement("button", {