Skip to content

Commit e9dd2de

Browse files
authored
fix: consistent location of search result
* fix 1098 * Update component.js * Update component.js
1 parent c0d3280 commit e9dd2de

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/plugins/search/component.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,20 @@ function bindEvents() {
171171
const $inputWrap = Docsify.dom.find($search, '.input-wrap');
172172

173173
let timeId;
174-
// Prevent to Fold sidebar
174+
175+
/**
176+
Prevent to Fold sidebar.
177+
178+
When searching on the mobile end,
179+
the sidebar is collapsed when you click the INPUT box,
180+
making it impossible to search.
181+
*/
175182
Docsify.dom.on(
176183
$search,
177184
'click',
178-
e => e.target.tagName !== 'A' && e.stopPropagation()
185+
e =>
186+
['A', 'H2', 'P', 'EM'].indexOf(e.target.tagName) === -1 &&
187+
e.stopPropagation()
179188
);
180189
Docsify.dom.on($input, 'input', e => {
181190
clearTimeout(timeId);

0 commit comments

Comments
 (0)