From 5b602fd969bc36c78c638ce72eeb99c827acb7ac Mon Sep 17 00:00:00 2001
From: Wouter Wolters <typo3@wouterwolters.nl>
Date: Fri, 25 Sep 2015 20:58:24 +0200
Subject: [PATCH] [TASK] Add clear button for LiveSearch

Resolves: #70508
Releases: master
Change-Id: Ifad9feb4ab07d201a769580631d0c1f3fb76b38c
Reviewed-on: http://review.typo3.org/43577
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
---
 Build/Resources/Public/Less/TYPO3/_topbar.less         |  6 ++++++
 .../backend/Resources/Public/JavaScript/LiveSearch.js  | 10 +++++++++-
 typo3/sysext/t3skin/Resources/Public/Css/backend.css   |  5 +++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/Build/Resources/Public/Less/TYPO3/_topbar.less b/Build/Resources/Public/Less/TYPO3/_topbar.less
index 3a36ca4dda40..d8697c582c0f 100644
--- a/Build/Resources/Public/Less/TYPO3/_topbar.less
+++ b/Build/Resources/Public/Less/TYPO3/_topbar.less
@@ -341,6 +341,12 @@
 			margin-top: -8px;
 			z-index: 1;
 		}
+
+		button.close {
+			opacity: 1;
+			color: @topbar-navigation-color;
+			text-shadow: none;
+		}
 	}
 	.form-control {
 		background-color: @tobar-navigation-search-bg;
diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js b/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js
index 35be20ae589c..dec2649a3cd3 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js
@@ -14,7 +14,7 @@
 /**
  * Global search to deal with everything in the backend that is search-related
  */
-define('TYPO3/CMS/Backend/LiveSearch', ['jquery', 'jquery/autocomplete'], function ($) {
+define('TYPO3/CMS/Backend/LiveSearch', ['jquery', 'jquery/autocomplete', 'TYPO3/CMS/Backend/jquery.clearable'], function ($) {
 
 	var containerSelector = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem';
 	var searchFieldSelector = '.t3js-topbar-navigation-search-field';
@@ -92,6 +92,14 @@ define('TYPO3/CMS/Backend/LiveSearch', ['jquery', 'jquery/autocomplete'], functi
 			evt.preventDefault();
 			jump($(this).data('target'), 'web_list', 'web', $(this).data('pageid'));
 		});
+
+		$(searchFieldSelector).clearable(
+			{
+				onClear: function() {
+					$(containerSelector).removeClass('open');
+				}
+			}
+		);
 	};
 
 	$(document).ready(function() {
diff --git a/typo3/sysext/t3skin/Resources/Public/Css/backend.css b/typo3/sysext/t3skin/Resources/Public/Css/backend.css
index cd3e29f31e76..9fc7cb16a7e8 100644
--- a/typo3/sysext/t3skin/Resources/Public/Css/backend.css
+++ b/typo3/sysext/t3skin/Resources/Public/Css/backend.css
@@ -13277,6 +13277,11 @@ iframe {
   margin-top: -8px;
   z-index: 1;
 }
+.typo3-topbar-navigation-search .form-group button.close {
+  opacity: 1;
+  color: #dddddd;
+  text-shadow: none;
+}
 .typo3-topbar-navigation-search .form-control {
   background-color: #222222;
   color: #dddddd;
-- 
GitLab