-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #1213 #1215
fix #1213 #1215
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/r40w71b80 |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ca460b7:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! It turned out to be a simple fix.
The added transition
seems to make the menu delay before closing. Let's remove the transition
just for this fix.
Thank you for finding this fix!
Also be sure to update the PR with the latest from develop
(there's an "Update" button below).
Fix looks good! |
@jhildenbiddle Did you check the menu animation (considering there's a new I would love to get your fix in @mohammedsahl! I think it is better to remove the animation tweak so we can merge the fix, then we can make animation tweaks in a new PR (happy for that to be improved too!). By the way, why did you add the transition? What browser are you in? Does it make it better for you on your end? |
@trusktr -- Very strange. I'm not seeing any lag on the latest versions of Safari (Mac, iPhone, iPad), Chrome (Mac), or Firefox (Mac). I'm previewing the latest deployment here: https://docsify-preview-qbuv6mk3f.vercel.app/ Have you tried other browsers in hopes of isolating the issue to Chrome? If it is Chrome-specific, verify that Chrome is hardware accelerated by typing in |
db540b6
@trusktr The transition was so that the cover "slides" into place rather than "snap". I've tried it on chrome for now. EDIT: I seem to have found the source of the lag body.close
.sidebar, .cover
transform translateX($sidebar-width)
.sidebar-toggle
background-color rgba($color-bg, 0.8)
transition 1s background-color
width $sidebar-width - 16px
padding 10px
.content
transform translateX($sidebar-width) This around lines 440-452 in _layout.styl Adding |
Nice work, @mohammedsahl! Still confused as to why I don't see the lag, but it's a moot point if you've solved the issue. |
I think there's a misunderstanding here, the lag issue is not entirely solved 😅
There is a third option where the user is not allowed to toggle the side bar when the cover page is displayed but that would, in my opinion, not be in line with the current design The version I've pushed currently is the first, but the downside is that there will be a lag when the side bar is toggled. |
#1173 I also feel that if the mobile terminal chooses to display the cover, it can not need the sidebar. |
Apologies for the misunderstanding, @mohammedsahl. So I dug into this a little bit... The original issue (not the lag issue) is caused the docsify-dark-mode plugin's style sheet. Specifically, this ruleset: html,
body,
main,
.sidebar-toggle,
.sidebar,
aside {
background: var(--docsify_dark_mode_bg);
} The issue is that the CSS custom property An easy way to verify this is to visit https://docsify.js.org and block the docsify-dark-mode stylesheet (see <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/dist/style.css"> Three ways to fix:
Any opposition to just removing the docsify-dark-theme plugin and stylesheet? |
Removed already, #1207, need a release also, the preview link should not have the |
Thank you @jhildenbiddle for the investigative work 😄 |
Apologies for the confusion, everyone. There are actually two completely separate issues, both of which coincidentally present themselves in similar ways. To make things even more confusing, I was debugging the code on https://docsify.js.org/ (master branch) when I should have been debugging the previews generated for this PR. Sorry about that. Hopefully the following screenshots and explanations will help clarify both issues and my recommendation on how to wrap up this PR.
Summary: I believe if @mohammedsahl simply removes changes made thus far along with the If your curious about the stacking context issue, here is an excellent article that helps explain in more detail: What No One Told You About Z-Index Whew. :) |
Thanks for the detailed explanation @jhildenbiddle . @mohammedsahl can you add the fix here as mention above ? |
I like the cover sliding to the right when the menu opens because it matches the same pattern as with the main content. I think it would be great to go with that solution (apart from fixing the background color). The lag problem only happens in mobile; I can reproduce while in mobile mode in devtools or on my phone. But guess what! I just remembered about the I set |
Turns out https://docsify.js.org has the same issue on mobile. I am happy to merge this then, and then we should fix the following next (new PRs would be fine):
|
@trusktr -- I don't mind the sliding coverpage. I'd still recommend removing the One other thing to consider is that Thanks for your patience on this one. I know there's been a lot of back and forth. Here's what I understand the next steps to be:
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to make the z-index change here or in a new PR.
Not sure what's going on @trusktr. No issues on my end. Let's get the changes I listed in my comment above made to this PR before spending more time troubleshooting previews. I believe those changes take everything we've discussed into account. Ideally those changes address all issues so we can close the PR and move on to the next thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, wait a second! I discovered why the lag is actually introduced. To see why,
- open the Vercel preview on mobile (i tested on Android Chrome)
- double tap anywhere (without tapping a link) and notice it does not zoom
- now open the menu. Notice there is no delay.
- now double tap anywhere (avoid links) and notice that it zooms out.
- zoom back in a tap the menu button and notice the lag
This lag is because the site has become zoomable due to the translation of the cover and causing it to render beyond the edge of the display. But notice that the main content does not render beyond the edge of the display.
So to solve the issue fully, I think we should ensure that we do not draw outside of the viewport. Let's see what the main content area does and see if we can copy that behavior.
The other option is we can disable zoom.
Applying touch-action:none to the button isn't good because it doesn't solve the issue that when the menu is open the user can scroll the whole site to the left. Try opening the menu on mobile then scroll the main content to the left while the menu is open.
@trusktr Here's something I'm not able to understand. Suppose we're scrolling through contents (not the cover page) and we click the sidebar-toggle. Why doesn't the web page zoom out when I double-tap a non-link area of the contents. Since The current behavior (observed on the Based on this, I will make changes based on this comment. Otherwise I can go with implement changes stated here |
I think we should refocus on the stated issue: To fix the presentation of the sidebar at <= 768px. In that spirit, I believe the steps should be the following:
The end result is a simple one-line fix. All other issues / enhancements (sliding coverpage, button delays, hidden content rendered outside of the viewport, etc.) are all outside the scope of this PR. That's not to say they aren't important, but this PR isn't the best place to explore or implement them. If we want to explore additional enhancements, let's file separate issue(s) so we can review and triage accordingly. |
Not exactly sure why the e2e tests are failing. Running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
Can't comment on the e2e tests as I haven't worked with them yet.
the e2e CI is kind of moody 😄 |
Thanks for your contribution 👍 |
@anikethsaha This wasn't ready yet. I had requested changes above. This causes the mobile site to zoom and scroll sideways, which we need to fix. |
Oh wait, nvm, I see @mohammedsahl made it to the cover doesn't translate. 👍 |
Summary
For devices having a width of
768px
or less the sidebar is overlapped by the cover pageThis PR fixes that by sliding the cover page over, similar to the content page
The bug is reproduced by loading the page on a device browser having a screen size of
786px
or lessand clicking the
sidebar-toggle
buttonWhat kind of change does this PR introduce? (check at least one)
Before
After
Does this PR introduce a breaking change? (check one)
The PR fulfills these requirements:
You have tested in the following browsers: (Providing a detailed version will be better.)
lib
directory.