UMB-CS-682-Team-03 / tracker

0 stars 0 forks source link

Make accumulator into a form so hitting return in preview submits. #68

Closed rouilj closed 5 months ago

rouilj commented 5 months ago

In a form hitting return in a plaintext input triggers the submit function. The searchFragment implements this. But the accumulator doesn't.

Wrap the accumulator input and buttons in a form so hitting return in the preview input submits the changes.

diff --git a/html/classhelper.js b/html/classhelper.js
index 3ff630ef..44d98c17 100644
--- a/html/classhelper.js
+++ b/html/classhelper.js
@@ -728,8 +735,11 @@ class ClassHelper extends HTMLElement {
         const fragment = document.createDocumentFragment();
         const container = document.createElement("div");
         container.id = "popup-control";
-        container.classList.add("popup-control");

+        const form = document.createElement("form")
+        form.id = "accumulator-form"
+        form.classList.add("popup-control");
+      
         const preview = document.createElement("input");
         preview.id = "popup-preview";
         preview.classList.add("popup-preview");
@@ -761,7 +771,8 @@ class ClassHelper extends HTMLElement {
             }))
         })

-        container.append(preview, cancel, apply);
+      form.append(preview, cancel, apply);
+      container.append(form)
         fragment.appendChild(container);

         return fragment;