WAI-ARIA states and properties: Practical examples

I’ve been trying to include some WAI-ARIA into the project I’m currently working on. Luckily for me I’m using jQuery’s UI dialog and autocomplete plugins and they come with ARIA states and properties straight out of the box! Adding ARIA to my own UI widgets led me to conclude that it’s quite tricky to get right.

I found it difficult to make sense of the specification and getting started took longer than I thought it might. The following are some of the states and properties I looked at:

aria-expanded: state

For pages that have large amounts of data/form editing I have implemented an interface where the user can expand or hide various sections as they wish. Using javascript, I add and update the aria-expanded state dynamically when each section is expanded and hidden.

<section aria-expanded="true" class="expand">
    <p>This section is currently expanded.</p>
</section>

<section aria-expanded="false" class="hide">
    <p>This section is currently hidden.</p>
</section>

aria-hidden: state

When javascript is enabled, the edit form allows for AJAX submits to save any information that is entered. In this case I have visually removed the submit button from the page and the aria-hidden state can be used to indicate that the element is not visible to any user. Using CSS display:none will hide the content from assistive-technologies (AT) that access the DOM through a rendering engine, so using ARIA in this instance will ensure that ATs accessing the DOM directly will not ‘see’ the element.

$(function() {
    $('button').attr('aria-hidden', 'true');
});

aria-haspopup: property

Some functionality on the page is not available to those users who are not logged in. When javascript is enabled, instead of redirecting the user to the login page I use a UI dialog box to explain why they can not access those functions. ATs have always had trouble knowing when overlays are active and aria-haspopup property can be used to indicate that the element will trigger items over the top of the main content.

<ul>
    <li aria-haspopup="true">
        <a href="/login">Function for logged in user</a>
    </li>
    <li><a href="/nice-features">Function for everyone</a></li>
</ul>

aria-owns: property

If your popup is not next to the element that triggered it in the DOM, you should use the aria-owns property to infer a parent/child relationship between them. This property’s value should be a unique ID to the popup.

<ul>
    <li aria-haspopup="true" aria-owns="login-popup">
        <a href="/login">Function for logged in user</a>
    </li>
    ...
</ul>

... more code ...

<div id="login-popup">
    <p>You must <a href="/login">login</a> to access 
    this feature.</p>
</div>

Duplication between HTML and ARIA

Some ARIA attributes seem to duplicate existing HTML attributes. I wanted to add aria-valuemax on a password input that already had the maxlength attribute set. In this case I decided that I should use both variations. The maxlength attribute has been in existence since HTML2.0 so browsers know the user should be prevented from inputting more characters than has been defined. We add aria-valuemax for AT that is specifically looking out for ARIA information.

I misread the spec on the aria-valuemax attribute. Gez Lemon kindly put me straight that aria-valuemin and aria-valuemax were only appropriate for range widgets.

Another example is the new HTML5 required attribute (for form fields that the user is required to complete) which is marked in ARIA by adding the aria-required attribute. The reason for adding both in this situation is that ARIA is quickly gaining support while browsers are only just beginning to support HTML5 and this will ensure your site is as accessible as possible.

More information

Please let me know if I’ve done something silly, it’s simply my interpretation of the spc and I may have got it wrong.

Tags: ,

23 Responses to “WAI-ARIA states and properties: Practical examples”

  1. Lucica says:

    Although some properties are duplicated in HTML5 and ARIA, since the screen readers do not support HTML5 very well but do support ARIA you made a very good choice by adding both. For example in your forms you have used required but you could also use aria-labelledby or described by which are useful too in my opinion. You might use live regions when submitting the form in order to give feedback to your visitors related to the state of the form: errors maybe, a successful submit. I don’t know what your project is about, but I found it useful to assign roles to the header, footer, the search form but most of all to the sidebar.

  2. WebAxe – Link Roundup – November 2010 « AccessTech News says:

    […] WAI-ARIA States & Properties: Practical Examples […]

  3. Link Roundup – November 2010 | magdal01 says:

    […] WAI-ARIA States & Properties: Practical Examples […]

  4. […] WAI-ARIA States & Properties: Practical Examples […]

  5. Dan says:

    Great round-up thanks. I’m just getting started with ARIA and found this article clear and (re)usable :-)

  6. Luke says:

    This is awesome stuff, I should have read about this all a while ago but this is a great post to start from, thanks!

  7. […] WAI-ARIA states and properties: Practical examples […]

  8. […] WAI-ARIA Landmarks: Using WAI-ARIA Landmarks and Practical examples […]

  9. kaitlinmc says:

    Hi and welcome to my blog . I’m Kyra Anthony.
    I have always dreamed of being a novelist but never dreamed I’d make a career of it. In college, though, I aided a fellow student who needed help. She could not stop complimenting me . Word got around and someone asked me for to write their paper just a week later. This time they would pay me for my work.
    During the summer, I started doing academic writing for students at the local college. It helped me have fun that summer and even funded some of my college tuition. Today, I still offer my writing skills to students.

    Writing Specialist – Kyra Anthony – Customwriters Confederation

  10. jeanhartm says:

    My name is Jean. And I am a professional Content writer with many years of experience in writing.

    My goal is to solve problems related to writing. And I have been doing it for many years. I have been with several associations as a volunteer and have assisted in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a passionate writer who started at an early age.
    I’m happy that I`ve already sold several copies of my poems in different countries like USA, Russia and others too numerous to mention.
    I also work in a company that provides assistance to many students from different parts of the world. People always come to me because I work no matter how complex their projects are. I help them to save time, because I feel fulfilled when people come to me for professional help.

    Professional academic Writer – Jean – Byrumsocialstudies Corps

  11. kyapier says:

    My name is Kya. And I am a professional Content writer with many years of experience in writing.

    My interest is to solve problems related to writing. And I have been doing it for many years. I have been with several groups as a volunteer and have assisted people in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a passionate writer who started at an early age.
    I’m happy that I`ve already sold several copies of my works in different countries like Canada and China and others too numerous to mention.
    I also work in a company that provides assistance to many people from different parts of the world. Clients always come to me because I work no matter how hard their projects are. I help them to save energy, because I feel fulfilled when people come to me for writing help.

    Professional academic Writer – Kya Pierce – Ebrcn Corps

  12. ambercrou says:

    Hello, it’s Amber here!
    I work as an academic writer and have created this content with the intent of changing your life for the better. I started honing my writing skills in high school. I learned that my fellow students needed writing help—and they were willing to pay for it. The money was enough to help pay my tuition for my remaining semesters of college.
    Ever since high school, I have continued to work as a professional writer. I was hired by a writing company based in the United Kingdom. Since then, the research papers that I have created have been sold around Europe and the United States.
    In my line of work, I have become familiar with hearing, “Amber, can you help me meet my writing assignment deadline?” I know that I can provide this service.

    Academic Writer – Amber – Rhythmnmotionstudio Team

  13. agatawhit says:

    Hi guys, it’s Agata Whitley here!
    I work as an academic writer and have created this content with the intent of changing your life for the better. I started honing my writing talent in high school. I learned that my fellow students needed writing help—and they were willing to pay for it. The money was enough to help pay my tuition for my first semester of college.
    Ever since college, I have continued to work as a professional writer. I was hired by a writing company based in the United Kingdom. Since then, the dissertations that I have created have been sold around Europe and the United States.
    In my line of work, I have become familiar with hearing, “Agata, can you help me meet my writing assignment deadline?” I know that I can provide this service.

    Professional Writer – Agata – //www.hipdoghomestudy.com/]Hipdoghomestudy Band

  14. lianaly says:

    My name is Liana. And I am a professional Content writer with many years of experience in writing.

    My goal is to solve problems related to writing. And I have been doing it for many years. I have been with several associations as a volunteer and have assisted people in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a passionate writer who started at an early age.
    I’m happy that I`ve already sold several copies of my books in different countries like USA, Russia and others too numerous to mention.
    I also work in a company that provides assistance to many students from different parts of the world. Clients always come to me because I work no matter how complex their projects are. I help them to save time, because I feel happy when people come to me for writing help.

    Academic Writer – Liana – Literaturematters Confederation

  15. sabrinar says:

    Hello, I’m Sabrina Russell.
    Welcome to my homepage . I started writing in high school after a creative writing assignment for my English teacher. I did creative writing for a while before I thought about doing something else.
    I had always loved doing research assignments because I’m passionate about learning. When you combine writing skill with a love of learning, academic writing only makes sense as a job.
    I’m passionate about assisting the students of the future in their school career. When they don’t have time for their paper , I am there to help.

    Sabrina – Professional Academic Writer – Check this Company

  16. katyapat says:

    Welcome everyone ! I’m Katya.
    Even though I jokingly credit my grandmother for my writing talent, I know that it is a ability I have fostered from childhood. Though my aunt is a writer, I also started out young.
    I’ve always had a way with words, according to my favorite professor . I was always so excited in history when we had to do a research writing assignment.
    Now, I help current learners achieve the grades that have always come easily to me. It is my way of giving back to students because I understand the troubles they must overcome to graduate.

    Katya Patel – Professional Writer – Click here Corps

  17. hydranig says:

    президент медведев петух козел гей трансвестит 50 CENT петух курочка обосанный пидор козел
    DKshop петух курочка обосанный пидор козел
    трансвестит гей педофил гомосексуалист педераст пидор петух козел hydra4jpwhfx4mst.onion
    кладу пустые клады кладов не найдете
    у русских большое очко
    кидалы верните деньги петухи козлы пидоры обоссыши ебанные

    купить амфетамин марихуана
    http://hydraruzxpnew4af.onion/market/1734 DKshop

  18. brandyhir says:

    My name is Brandy. And I am a professional academic writer with many years of experience in writing.

    My primary goal is to solve problems related to writing. And I have been doing it for many years. I have been with several organizations as a volunteer and have assisted people in many ways.
    My love for writing has no end. It is like the air we breathe, something I cherish with all my being. I am a passionate writer who started at an early age.
    I’m happy that I`ve already sold several copies of my works in different countries like Canada and China and others too numerous to mention.
    I also work in an organization that provides assistance to many clients from different parts of the world. Clients always come to me because I work no matter how complex their projects are. I help them to save time, because I feel fulfilled when people come to me for professional help.

    Ghost Writer – Brandy Hirst – 6 Ways To Plan A Luxury Vacation On A Budget Team

  19. joannab says:

    Hello, it’s Joanna here!
    I work as a professional an essay writer and have created this content with the intent of changing your life for the better. I started honing my writing talent in high school. I learned that my fellow students needed writing help—and they were willing to pay for it. The money was enough to help pay my tuition for my first semester of college.
    Ever since school, I have continued to work as an academic writer. I was hired by a writing company based in the United Kingdom. Since then, the research papers that I have written have been sold around Europe and the United States.
    In my line of work, I have become familiar with hearing, “Joanna, can you help me meet my writing assignment deadline?” I know that I can provide this service.

    Professional Writer – Joanna – https://www.screenwritermag.com/ – Screenwritermag Team

  20. katrinamer says:

    I’m an expert writer who loves to bring smiles to people’s face.

    Writing is what I do for a living and I am so passionate about this. I have worked with several companies whose goal is to help people solve problems.
    I love traveling and have visited several places in the past few years.
    I’m happy to have written several books that have contributed positively to the lives of many. My books are available in several parts of the world. And I’m currently working with service providers that help people save time. Being a part of this team has open more opportunities for me to excel as a writer. I have worked with different people and met many clients as a professional.
    I can handle any kind of writing project and provide nothing but the best. People come to me all the time to ask if I can solve their assignment problems and I accept. I find pleasure in assisting them to solve their problems as a writer.

    Academic Writer – Katrina Merrill – Soundgardenkinganimal Confederation

Leave a Reply