the use of role attribute

Hi guys,

I am studying bootstrap from W3schools.
what is the use of 'role' attribute?
can it have a different value than 'menu' here?
Is it required?

<div class="btn-group">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <div class="btn-group">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
    Sony <span class="caret"></span></button>
    <ul class="dropdown-menu" [b]role="menu"[/b]>
      <li><a href="#">Tablet</a></li>
      <li><a href="#">Smartphone</a></li>

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
The role attribute is there to describe what your element does - primarily for the benefit of screen readers. So for instance an <a> element with a role of button will be seen as a button by a screen reader rather than as a link.

More information here and here

To use or not to use - using them does not have any negative side effects but there are some instances where they are useful - therefore it is entirely up to you as to whether or not you include them.

In some cases CSS rules are applied to roles which means (depending on the source) you might have an instance where an element is not styled correctly because its role is missing.
Brandon LyonSenior Frontend DeveloperCommented:
To elaborate on Julian's answer and your question about which role it can have, here is the list of possible roles. Menu seems appropriate in your case.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IzzyTwinklyAuthor Commented:
Thanks guys!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.