Bugzilla – Attachment 169534 Details for
Bug 33668
Add a 'clear search' button/icon inside the search input box on the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33668: (follow-up) Modify the JS logic behind the 'Clear search' button
Bug-33668-follow-up-Modify-the-JS-logic-behind-the.patch (text/plain), 1.87 KB, created by
Andreas Roussos
on 2024-07-24 23:46:30 UTC
(
hide
)
Description:
Bug 33668: (follow-up) Modify the JS logic behind the 'Clear search' button
Filename:
MIME Type:
Creator:
Andreas Roussos
Created:
2024-07-24 23:46:30 UTC
Size:
1.87 KB
patch
obsolete
>From 9ab16806f231bc2ac40ac3761180015b76b5e596 Mon Sep 17 00:00:00 2001 >From: Andreas Roussos <a.roussos@dataly.gr> >Date: Wed, 24 Jul 2024 22:59:45 +0000 >Subject: [PATCH] Bug 33668: (follow-up) Modify the JS logic behind the 'Clear > search' button > >In the existing code, the 'Clear search' button would hide >itself after clearing anything typed at the search <input>. > >This patch adjusts the JavaScript logic so that when the >page first loads and the search <input> is empty, the >'Clear search' button will not be displayed at all. > >The 'X' (Clear search) button will only appear once the >user has typed something in the search <input> area. > >Test plan: > >1) Apply the patch. >2) Do a hard refresh (CTRL+F5) on the OPAC main page to > reload all JS assets. >3) Notice that the 'Clear search' button is not displayed. >4) Try to search for something -> the button appears! >5) Use the 'X' button to clear your search -> the search > terms are cleared and the 'X' button hides itself! >--- > koha-tmpl/opac-tmpl/bootstrap/js/global.js | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js >index 0f939c3d24..8a69c16615 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js >@@ -254,13 +254,14 @@ function setPlaceholder(){ > let clearButton = $('<span class="clear-search"><i class="fa-solid fa-square-xmark"></i></span>'); > > $("#translControl1").attr("placeholder", search_placeholder).after(clearButton); >+ clearButton.hide(); > > clearButton.click(function() { > $("#translControl1").val('').focus(); > $(this).hide(); > }); > >- $("#translControl1").on('input', function() { >+ $("#translControl1").on('input focus', function() { > if ($(this).val() !== '') { > clearButton.show(); > } else { >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33668
:
150602
|
169443
|
169444
|
169445
|
169446
|
169525
|
169526
|
169527
|
169528
|
169529
|
169530
|
169531
|
169532
|
169533
|
169534
|
169716
|
169717
|
169755
|
169756
|
169757
|
169758
|
169759
|
169760
|
169761
|
176579
|
176580
|
176813
|
176814
|
176815
|
176816
|
176817
|
176818
|
176819