-
Notifications
You must be signed in to change notification settings - Fork 123
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
548 navbar accessibility #559
548 navbar accessibility #559
Conversation
@Developer3027 I just uploaded this PR for the issue, if you have a chance to look it over and share your thoughts as well. |
@mononoken this is a good thing to change up, though I do have some thoughts on it:
|
@kasugaijin Good suggestion! I added clicking outside to close the menu. I also added the comments. |
I agree with above. Will review this afternoon. Thanks! |
After review, I like this approach. This does use a new css style set, however it follows convention, works like intended, and utilizes current theme attributes. The javascript in the Stimulus controller is straight forward and easy to read. Comments allow a clear understanding of what it does and the why is I agree it needs to be understood why this was done and to take note of both the Stimulus controller and the styles set. Maybe consider a note in the read me? Is documentation being considered, maybe there? |
Documentation is an ongoing challenge in codebases. I think the further the documentation gets away from the code, the harder it can be to find and update, and the README might not be the most practical location for code decisions. Ideally, code speaks for itself, and comments add context. I think in this case, I am happy with the inline comments, as added by @mononoken. |
Thank you both! Got the comment updated to ERB per Slack @kasugaijin . Think this should be good for final review. |
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.
LGTM!
🔗 Issue
#548
✍️ Description
Note: Enthusiastic to hear cleaner, alternative approaches. I am not a fan of bootstrap and avoid it in my personal projects, so I may not be familiar with some better ways to overwrite some of this behavior.
This PR aims to make the navigation bar more accessibility friendly. Currently the right corner navbar on desktop view only shows if you hover the icon. This is terrible for keyboard users as it makes it potentially impossible for them to open it, and that's the only place where some of those links live!
This behavior is coming from media queries from the theme we are using. Some of the culprit rules are here:
The first approach I tried was to just overwrite the CSS rules I found from the theme. However, that approach did not work because I don't think there is a way to overwrite the JavaScript that the theme is utilizing as well based off of the viewport widths.
What I opted for instead was to create our own custom class for the menu and also use a simple Stimulus controller to toggle/collapse the menu.
What I do not like about this approach is the custom CSS. If we change the theme, we would have to update this CSS as well. I think the Stimulus controller is nice for our own control, but it may not fully mimic the behavior from BS.
Alternatives:
I think I might like this approach better, but I also am not fully satisfied with it too. Potential issues with it I see are:
Fun fact, I noticed this hover behavior of the navbar has a test using a 5 second hover wait built into the
test/system/user.rb
test. Once @kasugaijin refactors the navbars so we use this one in both places, this new, no-hover behavior means we can shave 5 seconds off our test suite! lol📷 Screenshots/Demos
In this clip, the left side is the live site (main) and the right side is this branch.
https://github.com/rubyforgood/pet-rescue/assets/81536479/23e4683b-872e-47e9-b104-eff73a45e23d