Skip to content

Commit

Permalink
fix: consistent location of search result
Browse files Browse the repository at this point in the history
* fix 1098

* Update component.js

* Update component.js
  • Loading branch information
sy-records authored May 22, 2020
1 parent c0d3280 commit e9dd2de
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/plugins/search/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

1 comment on commit e9dd2de

@vercel
Copy link

@vercel vercel bot commented on e9dd2de May 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.