Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

inputs: Remove JS logic to determine empty/non-empty input fields.

Sayam Samal7a26c41c42f2
diff --git a/web/src/inputs.ts b/web/src/inputs.ts
index 4b4b907180d..d14c2456ca3 100644
--- a/web/src/inputs.ts
+++ b/web/src/inputs.ts
@@ -1,34 +1,5 @@
import $ from "jquery";
-// We use the `input` tag in the selector to avoid conflicts with the pill containing
-// counterpart, which uses a `contenteditable` div instead of an input element.
-$("body").on("input", "input.input-element", function (this: HTMLInputElement, _e: JQuery.Event) {
- if (this.value.length === 0) {
- $(this).removeClass("input-element-nonempty");
- } else {
- $(this).addClass("input-element-nonempty");
- }
-});
-
-$("body").on(
- "input change",
- ".has-input-pills .pill-container",
- function (this: HTMLInputElement, _e: JQuery.Event) {
- // We define another event handler for inputs with pill, similar to the one above.
- // However, due to the way inputs with pill use a contenteditable div instead of an
- // input element, we need to check the textContent of the pill container instead of
- // the value of an input element.
- // Here we need to listen to the `change` event in conjunction with the `input` event
- // to handle the addition or removal of input pills.
- const value = this.textContent?.trim() ?? "";
- if (value.length === 0) {
- $(this).removeClass("input-element-nonempty");
- } else {
- $(this).addClass("input-element-nonempty");
- }
- },
-);
-
$("body").on(
"click",
".filter-input .input-button",
diff --git a/web/styles/inputs.css b/web/styles/inputs.css
index b0e83b2bde2..5ba185c0705 100644
--- a/web/styles/inputs.css
+++ b/web/styles/inputs.css
@@ -38,12 +38,9 @@
}
&:focus {
- box-shadow: 0 0 5px var(--color-box-shadow-input-focus);
- }
-
- &:focus,
- &.input-element-nonempty {
@extend .input-active-styles;
+
+ box-shadow: 0 0 5px var(--color-box-shadow-input-focus);
}
}
@@ -86,12 +83,9 @@
}
&:has(.input:focus) {
- box-shadow: 0 0 5px var(--color-box-shadow-input-focus);
- }
-
- &:has(.input:focus),
- &.input-element-nonempty:has(.input) {
@extend .input-active-styles;
+
+ box-shadow: 0 0 5px var(--color-box-shadow-input-focus);
}
}
}