Problem/Motivation
Hi, I recently installed Bootstrap Barrio on my site and while I was setting it up I noticed the hamburger menu collapse icon was missing on smaller screen sizes (mobile). It is invisible but if you click it it successfully opens the navigation.
Proposed resolution
I have been looking at the code and found that the button with the <span class="navbar-toggler-icon"></span>
inside for the navigation is not showing because the navbar-light or navbar-dark class needs to be added to the button. I tried adding navbar-light
to the parent button and the icon showed. This is probably a bug in Barrio because the navigation was generated automatically and I did not write this code. If it is not an error, how can I add this class or make the hamburger menu icon appear?
(Bootstrap classes work fine on the rest of the site as well as jQuery.)
Comment | File | Size | Author |
---|---|---|---|
AFTER CLASS MANUALLY ADDED.png | 35.54 KB | elij | |
Screenshot (75).png | 34.44 KB | elij |
Comments
Comment #2
elij CreditAttribution: elij commentedNote that I am running this on Drupal 9.0.1
Comment #3
elij CreditAttribution: elij commentedI've been checking back regularly and don't see any activity on this issue, has anyone found a fix?
Comment #4
quinns CreditAttribution: quinns commentedA workaround is to add the SVG background image into your theme's CSS (this is copied from Bootstrap's source):
Comment #5
AngryBunny CreditAttribution: AngryBunny as a volunteer commentedWhat quinns provided worked for me (well after I changed the rgba values from white to black!)
Comment #6
gisleThis problem is also present in the latest stable release, updating version number.
I am running Drupal 8.9.2, so it does not depend on Drupal version.
The workaround suggested by quinns in comment #4 (adding the class to the subtheme's
css/style.css
) works for me.Comment #7
hatuhay CreditAttribution: hatuhay commentedAccording to Bootstrap docs Toggler the icon will take color based on parent nav link class, light or dark.
If you do not define any of thiose on your subtheme settings, then you need to add your own toggler icon using your style sheet.
Comment #8
tancTo clarify a little more, you need to edit your subtheme's settings and you'll see a section at the top of the form called "Bootstrap settings" which will be a vertical tabbed list. Under "Components" you can expand "Navbar structure" and there you need to choose an option other than "Default" for "Navbar link color". This will make the 'burger icon' show.
A third option is to add it in the field "Custom classes for Navbar", for example
navbar-light
Another option is to modify your theme's templates and add one of the bootstrap classes (e.g.
navbar-light
)on an ancestor of the.navbar-toggler-icon
element.Comment #9
jglynn CreditAttribution: jglynn commentedIf you are using the AdvAgg module to compress css the toggler svg will not appear. Somehow the svg text gets messed up