From 35debbc7321edd58ab4f173c28ca1e70e8a17619 Mon Sep 17 00:00:00 2001 From: Sakti Kumar Chourasia Date: Fri, 17 May 2019 00:23:30 +0530 Subject: [PATCH 1/3] fixed h3 topics with Markdown formatting causes a glitch on mobile --- packages/docusaurus-1.x/lib/core/nav/SideNav.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/docusaurus-1.x/lib/core/nav/SideNav.js b/packages/docusaurus-1.x/lib/core/nav/SideNav.js index 59906b189c25..33c5d016a5d8 100644 --- a/packages/docusaurus-1.x/lib/core/nav/SideNav.js +++ b/packages/docusaurus-1.x/lib/core/nav/SideNav.js @@ -189,8 +189,14 @@ class SideNav extends React.Component { const headings = document.querySelector('.toc-headings'); headings && headings.addEventListener('click', function(event) { - if (event.target.tagName === 'A') { - document.body.classList.remove('tocActive'); + let el = event.target; + while(el !== event.currentTarget){ + if (el.tagName === 'A') { + document.body.classList.remove('tocActive'); + break; + } else{ + el = el.parentNode; + } } }, false); From 2a3a6944bd016336a015e4fe46aeb08272974a18 Mon Sep 17 00:00:00 2001 From: Sakti Kumar Chourasia Date: Sat, 18 May 2019 09:57:34 +0530 Subject: [PATCH 2/3] replaced currenttarget to headings for if check --- packages/docusaurus-1.x/lib/core/nav/SideNav.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docusaurus-1.x/lib/core/nav/SideNav.js b/packages/docusaurus-1.x/lib/core/nav/SideNav.js index 33c5d016a5d8..252218aa354f 100644 --- a/packages/docusaurus-1.x/lib/core/nav/SideNav.js +++ b/packages/docusaurus-1.x/lib/core/nav/SideNav.js @@ -190,7 +190,7 @@ class SideNav extends React.Component { const headings = document.querySelector('.toc-headings'); headings && headings.addEventListener('click', function(event) { let el = event.target; - while(el !== event.currentTarget){ + while(el !== headings){ if (el.tagName === 'A') { document.body.classList.remove('tocActive'); break; From a977634dbb7b5f3b8858c54e4a9cf6eb624357c5 Mon Sep 17 00:00:00 2001 From: endiliey Date: Sat, 18 May 2019 13:49:48 +0800 Subject: [PATCH 3/3] use var instead of es6 --- packages/docusaurus-1.x/lib/core/nav/SideNav.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docusaurus-1.x/lib/core/nav/SideNav.js b/packages/docusaurus-1.x/lib/core/nav/SideNav.js index 252218aa354f..82d26f297bda 100644 --- a/packages/docusaurus-1.x/lib/core/nav/SideNav.js +++ b/packages/docusaurus-1.x/lib/core/nav/SideNav.js @@ -187,9 +187,9 @@ class SideNav extends React.Component { createToggler('#navToggler', '#docsNav', 'docsSliderActive'); createToggler('#tocToggler', 'body', 'tocActive'); - const headings = document.querySelector('.toc-headings'); + var headings = document.querySelector('.toc-headings'); headings && headings.addEventListener('click', function(event) { - let el = event.target; + var el = event.target; while(el !== headings){ if (el.tagName === 'A') { document.body.classList.remove('tocActive');