-
-
Notifications
You must be signed in to change notification settings - Fork 66
Make the theme responsive #46
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
Changes from 1 commit
7aba474
203b40a
10f4349
ff61d60
7640739
ecf73cf
43da2b4
51a0c7a
efd1ec2
7953f1b
6daa876
250dbf6
5ffa114
e1ee8bd
1e182f3
611a1dc
783b19a
d31371e
190931b
b6fc448
cd92c8c
ed7b948
d96713e
bd1d802
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
document.addEventListener('DOMContentLoaded', function () { | ||
const toggler = document.querySelector('.toggler'); | ||
const sideMenu = document.querySelector('.menu-wrapper'); | ||
const doc = document.querySelector('.document'); | ||
function closeMenu() { | ||
sideMenu.classList.remove('open'); | ||
toggler.checked = false; | ||
} | ||
toggler.addEventListener('change', function (e) { | ||
if (toggler.checked) { | ||
sideMenu.classList.add('open'); | ||
} else { | ||
closeMenu(); | ||
} | ||
}); | ||
doc.addEventListener('click', function () { | ||
if (toggler.checked) { | ||
closeMenu(); | ||
} | ||
}) | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By moving the checkbox up in the dom tree it may be possible to implement this using only javascript and make it more accessible for people without javascript There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I replaced the checkbox with a button. Is this better for people without javascript? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I would have done is move the input as a checkbox directly next to the sidebar, reference it in the label via id and apply the styles based on whether the checkbox is checked or not. I may have time tomorrow to create a PR on your fork repo if you want to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have done it like this at first (checkbox input and applying styles based on :checked property). Then I was checking for accessibility and found this article which shows that a button as menu opener has some advantages regarding accessibility: namely, it is easier to set up keyboard handling. On the other hand, I just realized that people probably don't use keyboard for navigation on mobile, and it is more important to set up No-script solution than keyboard navigation on mobile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In addition if you follow this guide you also get a working css only solution with added accesibility using javascript |
Uh oh!
There was an error while loading. Please reload this page.