Making Boostrap Menu Accessble:
Example 3: Close the menu when the user clicks a link
Before beginning, make the browser narrow enough to go to the hamburger menu.
This is the default after trapping Esc key to close the menu.
Use this jQuery script to cause the menu to close when you click a link.
<script>
$('.navbar-collapse a').click(function(){
$(".navbar-collapse").collapse('hide');
});
</script>
Problems to overcome
- The menu doesn't close when the user clicks a link
- If the user tabs through the list of links the menu doesn't close as they tab from the last item to the first item after the menu
- If the user clicks elsewhere on the page the menu doesn't close, it should.
- Tapping the screen eslewhere on the page doesn't close it.
- Tapping the screen eslewhere on the page doesn't close it.
- in iOS and VoiceOver