[PHP-WEBMASTER] [web-php] master: Exclude input and textarea from "/" key handler (#1213)

Author: Luffy (sy-records)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2025-01-28T09:30:52+08:00

Commit: Exclude input and textarea from "/" key handler (#1213) · php/web-php@8231de0 · GitHub
Raw diff: https://github.com/php/web-php/commit/8231de0a322b1557670a6168387aad01d3916030.diff

Exclude input and textarea from "/" key handler (#1213)

Changed paths:
  M js/search.js

Diff:

diff --git a/js/search.js b/js/search.js
index 6c486d30d9..69248837b6 100644
--- a/js/search.js
+++ b/js/search.js
@@ -294,7 +294,13 @@ const initSearchModal = () => {

     // Open when / is pressed
     document.addEventListener("keydown", (event) => {
- if (event.target.contentEditable === "true") {
+ const target = event.target;
+
+ if (
+ target.contentEditable === "true" ||
+ target.tagName === "INPUT" ||
+ target.tagName === "TEXTAREA"
+ ) {
             return;
         }