diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html
index 87fb9ec96b9b7dc0a279a709d633473e1679c59f..f043d72baae23d9fdb95df59f201a9f7f2547188 100644
--- a/pd/nw/dialog_search.html
+++ b/pd/nw/dialog_search.html
@@ -451,6 +451,12 @@ function doc_search() {
         results,
         doc,
         i;
+    // if the search term is empty then just redisplay the toc
+    if (!search_text) {
+        clear_results();
+        display_toc();
+        return;
+    }
     // if the search term is doc/* short circuit the search and
     // just list the docs in that directory
     if (search_text.slice(0, 4) === "doc/" &&