Problem Statement
How do you ensure a dropdown is keyboard friendly and screen reader friendly?
Explanation
Always use a button as the dropdown toggle so it can receive focus and support keyboard actions. Bootstrap automatically adds aria-expanded and manages focus inside the menu.
Keep menu items as real links or buttons with clear labels. Close the dropdown on Escape, and for long menus, group related items with headers for better navigation.
Code Solution
SolutionRead Only
<button class='btn btn-secondary dropdown-toggle' data-bs-toggle='dropdown' aria-expanded='false'>Actions</button>
