Skip to content
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 sidebar closing problem on mobile while clicking among catalog items #1564

Closed
wants to merge 1 commit into from

Conversation

bigablecat
Copy link

@bigablecat bigablecat commented May 2, 2021

Summary

What kind of change does this PR introduce?

For any code change,

  • Related documentation has been updated if needed
  • Related tests have been updated or tests have been added

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

Related issue, if any:

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

@vercel
Copy link

vercel bot commented May 2, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/FSi83wev1QmMp7yjcM3tYHnNwNYo
✅ Preview: https://docsify-preview-git-fork-bigablecat-develop-docsify-core.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 2, 2021

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 35cd3c1:

Sandbox Source
docsify-template Configuration

@bigablecat
Copy link
Author

bigablecat commented May 2, 2021

details description of problem:

Under mobile mode, any click on one of the catalog items will causing sidebar closing.
For this reason, we cannot choose from catalog items in one time and have to reopen the sidebar several times until we make a final choise
A resonable design could be clicking on the content part other than any part of the body to trigger the sidebar closing.

@sy-records
Copy link
Member

Can you add tests to it?

@bigablecat
Copy link
Author

bigablecat commented May 3, 2021

Can you add tests to it?

I'd like to add tests.
Where could I find instructions about what kind of tests and how could I add tests?

Do you mean by attaching pictures?
screen shot: before fix the bug using chrome on iphone
https://user-images.githubusercontent.com/12821714/116856395-acf25300-ac2d-11eb-8356-4a67fe510b75.mp4

screen shot: after fix the bug using chrome on iphone
https://user-images.githubusercontent.com/12821714/116856413-b380ca80-ac2d-11eb-961e-d89f97e56792.mp4

@sy-records sy-records requested a review from a team May 4, 2021 00:12
@jhildenbiddle
Copy link
Member

jhildenbiddle commented May 4, 2021

This change solves one problem (for some) while introducing a new problem (for everyone): the sidebar menu no longer auto-closes when new content is loaded. This means all users will be forced to manually close the sidebar after navigating to a new page. While some may prefer this behavior, it is not safe to assume everyone will.

The correct way to address this issue is by adding support for expand/collapse toggles in the sidebar that exist only to hide/show content. Docsify does not support this today, but there are relative easy ways to implement it.

For example:

* Text Heading (no expand/collapse)
  * [Page 1](page1.md)
  * [Page 2](page2.md)

+ Toggle Heading (click to expand)
  + [Page 1](page1.md)
  + [Page 2](page2.md)

- Toggle Heading (click to collapse)
  - [Page 1](page1.md)
  - [Page 2](page2.md)

Text Heading

Toggle Heading (click to collapse)
Toggle Heading (click to expand)

This can all be done by modifying the markdown parser's handling of <li> elements and updating the sidebar toggle logic to auto-close the sidebar when the URL changes (not onClick).

There are multiple open requests for official expand/collapse toggle solution in the sidebar: #728, #900, #1181, #1200. closing this PR in favor of those.

@bigablecat
Copy link
Author

@jhildenbiddle
that sounds reasonable, thanks for your kind advice

@sy-records
thanks for your review as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants