From e9dd2de384b81619aae2bcbf92f52721cb76a177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=94=81?= <52o@qq52o.cn> Date: Fri, 22 May 2020 17:55:40 +0800 Subject: [PATCH] fix: consistent location of search result * fix 1098 * Update component.js * Update component.js --- src/plugins/search/component.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/search/component.js b/src/plugins/search/component.js index 33f1a55fc..388de395d 100644 --- a/src/plugins/search/component.js +++ b/src/plugins/search/component.js @@ -171,11 +171,20 @@ function bindEvents() { const $inputWrap = Docsify.dom.find($search, '.input-wrap'); let timeId; - // Prevent to Fold sidebar + + /** + Prevent to Fold sidebar. + + When searching on the mobile end, + the sidebar is collapsed when you click the INPUT box, + making it impossible to search. + */ Docsify.dom.on( $search, 'click', - e => e.target.tagName !== 'A' && e.stopPropagation() + e => + ['A', 'H2', 'P', 'EM'].indexOf(e.target.tagName) === -1 && + e.stopPropagation() ); Docsify.dom.on($input, 'input', e => { clearTimeout(timeId);