Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Event binding of body.ready on mobile devices causes abnormal switching of the sidebar

オープン
#1,697 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
frontend

調査の方向性

再現可能な CodeSandbox と、1932~1938 行付近にある btn 関数から始めます。button.sidebar-toggle を使ってモバイルデバイスで動作を再現し、その後 body のクリックバインディングを調べ、ボタンが引き続き機能する一方で、サイドバーのクリックによって意図しないトグルが発生しなくなっていることを確認します。

索引モデルが issue の本文から書いたものです。

説明

needs investigation

Bug Report

On mobile devices, docsify will add a click event to the body element.
When the event is not removed, clicking any area in the left sidebar will trigger its switching function.
After removing the event, the function is normal.

Its position is between 1932 -> 1938:

   function btn(el) {
     var toggle = function (_) {return body.classList.toggle('close'); };

     el = getNode(el);
     if (el === null || el === undefined) {
       return;
     }

     on(el,'click', function (e) {
       e.stopPropagation();
       toggle();
     });
     // this position
     isMobile &&
       on(
         body,
         'click',
         function (_) {return body.classList.contains('close') && toggle();}
       );
   }

Just like in the picture, this is when I did not remove the event:

bug1

When I removed the event, everything returned to normal:

bug2

I don't understand the meaning of this event, because after I disable it, I feel that everything is normal.

Steps to reproduce

On mobile devices, click button.sidebar-toggle. Click again on any area in the sidebar.

What is current behaviour

It will automatically close the sidebar.

What is the expected behaviour

Only when the button.sidebar-toggle button is clicked, can the sidebar toggle function be triggered.

Other relevant information
  • Bug does still occur when all/other plugins are disabled?

  • Your OS: ubuntu 20.04.3 LTS

  • Node.js version: 10.24.1

  • npm/yarn version: 6.4.12

  • Browser version: any browser

  • Docsify version: 4.4.3

  • Docsify plugins:

gitalk
search
emoji
docsify-copy-code
countable
pangu
sidebar
progress
gifcontrol
pagination
Please create a reproducible sandbox

Edit 307qqv236

Mention the docsify version in which this bug was not present (if any)
主要言語
JavaScript
スター
31.5k
フォーク
5.8k
平均マージ
2日 14時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docsifyjs/docsify のほかの issue

docsifyjs/docsify の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。