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

Make darkfish more responsive and readable on mobile devices #1162

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions lib/rdoc/generator/template/darkfish/css/rdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,17 @@ nav a:hover {
#navigation-toggle {
z-index: 1000;
font-size: 2em;
position: absolute;
display: block;
position: fixed;
Comment on lines +222 to +223
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking: I actually like the sidebar on the left, even if it moves. I think most websites work like that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sidebar is still on the left.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry. I meant the icon.

Copy link
Contributor

Choose a reason for hiding this comment

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

In any case, we could add a background color to the icon, so when it is on top of text it is still visible. I think I had that in the first PR

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the right solution is to properly implement a sticky navbar at the top when on small screens that displays the button on the left as you suggest, and the nav icon will never hover over text.
Before that happens, I think putting the button to the right on mobile is less intrusive.

top: 10px;
left: 20px;
}

#navigation-toggle[aria-expanded="true"] {
top: 10px;
left: 250px;
}

#navigation-toggle[aria-expanded="false"] {
top: 10px;
left: 20px;
}

nav ul li details {
position: relative;
padding-right: 1.5em; /* Add space for the marker on the right */
Expand Down Expand Up @@ -265,6 +263,7 @@ main {
font-size: 16px;
line-height: 1.6;
color: var(--text-color);
box-sizing: border-box;
}

@media (min-width: 1024px) {
Expand Down Expand Up @@ -715,4 +714,31 @@ main .attribute-access-type {
font-family: var(--font-code);
}

@media (max-width: 480px) {
nav {
width: 100%;
}

main {
margin: 1em auto;
padding: 0 1em;
max-width: 100%;
}

#navigation-toggle {
right: 10px;
left: auto;
}

#navigation-toggle[aria-expanded="true"] {
left: auto;
}

table {
display: block;
overflow-x: auto;
white-space: nowrap;
}
}
/* @end */