commit d48dc7defd1b132f0387e7e11cc04b8489e29e2d
parent 5a343ab38cc91be760ddebe2a51580191096a280
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Thu, 5 Sep 2024 12:20:57 -0700
Add TODO
Currently has a bit of info about my plans to implement a text
filtered menu to replace <select> <options>.
Diffstat:
| A | TODO | | | 33 | +++++++++++++++++++++++++++++++++ |
1 file changed, 33 insertions(+), 0 deletions(-)
diff --git a/TODO b/TODO
@@ -0,0 +1,33 @@
+# Options filtered by text
+
+1. Figure out how to position the options so that they (A) don't
+ alter the document-flow, (B) stay right below the filtering text
+ input, and (C), disappear when input is not focused.
+
+ The selection is fairly easy, here's what I had written before
+ realizing that positioning the list would proove difficult:
+
+ enumSelection(enums, input) {
+ let enums = document.createElement("ul")
+ enums.classList.add("enums")
+ input.after(enums)
+
+ function showEnums(values) {
+ let items = []
+ for (let i in values) {
+ let item = document.createElement("li")
+ item.appendChild(document.createTextNode(values[i]))
+ items.push(item)
+ }
+ enums.replaceChildren(...items)
+ }
+
+ showEnums(values)
+ input.addEventListener("input", function(ev) {
+ showEnums(values.filter(function(item) {
+ return item.includes(input.value)
+ }))
+ })
+
+ return input
+ }