Fix: Remove duplicate header logo anchor element#5204
Fix: Remove duplicate header logo anchor element#5204dsmchen wants to merge 1 commit intoTheOdinProject:mainfrom
Conversation
There was a problem hiding this comment.
Hmmm, unfortunately the fix isn't as simple as that because it turns out the logo component is also used in
for the mobile sidebar menu, and the current changes have both SVGs show.
@JoshDevHub @KevinMulhern any thoughts on preferred way forward?
The issue is having two anchors still focusable even if their contents are visually hidden.
Probably simplest way would be to move the hiding to the anchors themselves and not their images. So still have two anchors in the header but only one will be focusable at any one time. That would also require amending the logo component because the classes param only applies to the image contents, but we'd want to pass in classes for the image and the anchor separately so the anchor can be given hidden lg:block in the navbar and nothing in the mobile menu.
|
Footer also duplicates it on mobile: This is because most callsites don't pass a default And that means the svg won't get hidden at smaller screen sizes (where the image will also be visible). I'm not confident what the best thing to do is. I'm kinda curious why the code was originally written like it was. Basically:
Maybe Kev can say some more about it when he looks at this, but to me, why have the image at all? Is there something I'm missing about just using the plain old |
|
Explored this a bit more with Josh earlier. We wonder if we can just drop the icon-only logo anchor entirely, and keep the long logo in all situations. The only thing that would need tweaking would be some margin/gap stuff with the header nav at just above 767px (the sm/md cutoff) as for about ~40px above it, some of the nav items individually wrap and look off. @dsmchen I'll play around with this more when I get the time but in the meantime, if you want to play around with this too and explore not needing to hide/switch between icon-only and long logos, do feel free! |
|
RE: my last post, Mao told me why there were two different icons lol. If you can't get the wide icon to work right above the mobile breakpoint, I think I'm actually fine with a bit of a refactor. To my mind, what's going on here is that we would like
|
|
Do we need a collapsible logo in the first place? If we can successfully tweak the navbar spacing just above 767px breakpoint, then we could just keep the one logo in its full form since at 767px and below, the navbar disappears into the hamburger menu anyway (and IIRC, might have missed something), the "collapsible" behaviour is only used in the header because of the navbar |
|
Ah, missed the "if" but also good point about the navbar if signed out. |
|
Actually after thinking on this more, I think we can just refactor with ViewComponent slots. Sorry this unintentionally became a more involved problem @dsmchen. Here's the ViewComponent documentation to maybe help with some of the vocabulary I'm about to use. But essentially, we could allow the I'm not sure whereabouts in the curriculum you are or what your experience with Ruby/Rails is, so if everything I just typed is flying over your head, just let me know and I can offer more guidance. |
Hey @JoshDevHub, I'm on the JavaScript path, so your suggestion is beyond me. 😅 Perhaps we can open up this PR to others? Maybe someone on the Ruby on Rails path would like to work on this. |
|
I can probably just do it myself really quick. It's kind of a tricky issue, probably even for Rails learners because we don't show ViewComponent in the curriculum. Thank you for having this idea though! |


Because
There are 2 header logo anchor elements that are always shown on desktop/mobile. The anchor elements are functionally identical (same
hrefandaria-label), the only difference being the contents.This PR
<img>inside the second anchor element.blockfrom the<img>classes since that's the default anyway.Issue
Closes #5200
Additional Information
Pull Request Requirements
keyword: brief description of changeformat, using one of the following keywords:Feature- adds new or amends existing user-facing behaviorChore- changes that have no user-facing value, refactors, dependency bumps, etcFix- bug fixesBecausesection summarizes the reason for this PRThis PRsection has a bullet point list describing the changes in this PRIssuesection