From 50f2e4d52ea1fb7c175f217212ee40eac7164ca4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=2E=20Rene=CC=81e=20Beach?= <splendidnoise@gmail.com>
Date: Thu, 8 Aug 2013 13:49:04 -0400
Subject: [PATCH] Issue #2060573 by tim.plunkett, jessebeach: Standardized
 filter/search behavior; surface filter matches regardless of their containing
 box's open state
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: J. Renée Beach <splendidnoise@gmail.com>
---
 core/modules/system/system.modules.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/core/modules/system/system.modules.js b/core/modules/system/system.modules.js
index 4d97652..9ca9f85 100644
--- a/core/modules/system/system.modules.js
+++ b/core/modules/system/system.modules.js
@@ -38,12 +38,18 @@ Drupal.behaviors.tableFilterByText = {
       if (query.length >= 2) {
         $rows.each(showModuleRow);
 
+        // Note that we first open all <details> to be able to use ':visible'.
+        // Mark the <details> elements that were closed before filtering, so
+        // they can be reclosed when filtering is removed.
+        $details.not('[open]').attr('data-drupal-system-state', 'forced-open');
         // Hide the package <details> if they don't have any visible rows.
-        // Note that we first show() all <details> to be able to use ':visible'.
-        $details.show().each(hidePackageDetails);
+        $details.attr('open', 'open').each(hidePackageDetails);
       }
       else {
         $rowsAndDetails.show();
+        // Return <details> elements that had been closed before filtering
+        // to a closed state.
+        $details.filter('[data-drupal-system-state="forced-open"]').removeAttr('open data-drupal-system-state');
       }
     }
 
-- 
1.8.2

