Skip to content

Add support for mobile screen sizes on Darkfish - #1025

Merged
st0012 merged 3 commits into
ruby:masterfrom
MatheusRich:mr/mobile-docs
Aug 3, 2024
Merged

st0012 merged 3 commits into
ruby:masterfrom
MatheusRich:mr/mobile-docs

Conversation

@MatheusRich

@MatheusRich MatheusRich commented Jul 5, 2023 •

Copy link
Copy Markdown
Contributor

This adds support for reading the Darkfish-generated docs in mobile devices. I tried to keep the changes minimal, and the current layout was mostly preserved.

The most notable change is the navigation sidebar, which is now hidden by default on "small screens" (everything below 1024px). It can be toggled by the button on the top left corner. This button implements the ARIA pattern for a disclosure widget. The icon for the button was taken from Iconoir, which is licensed under the MIT license.

The design and some of the implementation were loosely inspired by the Elixir lang docs.

Screenshots

General look (before/after)

image image

Code blocks (before/after)

image image

Desktop view (before/after)

The most notable change here is that I limited the content size to about 1000px. Long lines are hard to read, so I added this little quality-of-life improvement for desktop users.

image image

The sidebar can also be closed on desktop:

image

Video

Screen.Recording.2023-07-05.at.19.59.33.mov

Testing

I wasn't sure if this change required tests. LMK if I need to add them.

@MatheusRich
MatheusRich marked this pull request as ready for review July 5, 2023 23:01
@nobu

nobu commented Jul 6, 2023

Copy link
Copy Markdown
Member

Thank you, seems very nice.
Just one concern, when resizing the navigation pane, the menu icon doesn't move.

@MatheusRich

MatheusRich commented Jul 6, 2023 •

Copy link
Copy Markdown
Contributor Author

when resizing the navigation pane, the menu icon doesn't move.

@nobu, I totally missed that it is resizable! Would it be a problem if we make it fixed-sized? I think that would be a small sacrifice for a simpler solution.

Edit: I made the sidebar fixed-sized.

@MatheusRich
MatheusRich requested a review from nobu July 11, 2023 13:19
@MatheusRich

Copy link
Copy Markdown
Contributor Author

@nobu could you approve the workflow so we can see if this works on CI? Thank you!

@MatheusRich

Copy link
Copy Markdown
Contributor Author

It looks like the tests breaking here are the same as the ones in the main branch.

@MatheusRich

Copy link
Copy Markdown
Contributor Author

@nobu @hsbt is there something I can do to move this forward?

@MatheusRich

Copy link
Copy Markdown
Contributor Author

@nobu @hsbt I've rebased this PR. CI should pass now.

@MatheusRich

Copy link
Copy Markdown
Contributor Author

Sorry to ping you again, @nobu. Can we get a second look at this?

@MatheusRich

Copy link
Copy Markdown
Contributor Author

cc @eregon @hsbt

@MatheusRich

Copy link
Copy Markdown
Contributor Author

@peterzhu2118 can you take a look at this?

This adds support for reading the Darkfish-generated docs in mobile devices.
I tried to keep the changes minimal, and the current layout was mostly
preserved.

The most notable change is the navigation sidebar, which is now hidden by
default on "small screens" (everything below 1024px). It can be toggled by
the button on the top left corner. This button implements the ARIA
pattern for a [disclosure widget]. The icon for the button was taken from
[Iconoir], which is licensed under the MIT license.

The design and some of the implementation were loosely inspired by the
[Elixir lang docs].

[disclosure widget]: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/
[Iconoir]: https://iconoir.com/
[Elixir docs]: https://hexdocs.pm/elixir/1.15.2/Kernel.html
@MatheusRich

Copy link
Copy Markdown
Contributor Author

@hsbt any plans on merging this (or not)?

@hsbt

hsbt commented Mar 18, 2024

Copy link
Copy Markdown
Member

I have no opinion that.

@nobu How about your opinion?

@colby-swandale colby-swandale self-assigned this Jul 8, 2024
@colby-swandale
colby-swandale self-requested a review July 8, 2024 12:12
@MatheusRich

Copy link
Copy Markdown
Contributor Author

@colby-swandale LMK if you have any thoughts on this

@st0012 st0012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tested the changes locally and I'd really love to see this merged 👍 But unfortunately I don't know enough css to give a confident review.

@st0012 st0012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since RDoc's own documentation ruby.github.io/rdoc/ is built with the latest RDoc, I think we can merge this PR and see how these changes play out.

@st0012
st0012 merged commit 755a2cf into ruby:master Aug 3, 2024
@MatheusRich
MatheusRich deleted the mr/mobile-docs branch August 5, 2024 16:02
@jhawthorn

Copy link
Copy Markdown
Member

Is this behaving as intended? On desktop (macbook air M2, seems to be the same in firefox, safari, and chrome) I get a sidebar open by default covering a large portion of the page (but also not the full page height)

Screenshot 2024-08-07 at 19-02-42 class RDoc Store - rdoc 6 7 0 Documentation

@MatheusRich

Copy link
Copy Markdown
Contributor Author

@jhawthorn there's an open PR to fix that already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants