relationship
Provide to the user a meaningful associations between distinct pieces of content
Description
When the relationship between two elements that affect each other (e.g. hide. display, change state, etc.) is not implied by the DOM structure, you can express the nature of the relationship by attributes that instructs screen readers how to read and mediate the relationship correctly to the user. The WAI-ARIA has a variety of relationship-related attributes that indicate relationships or associations between elements that cannot be readily determined from the document structure. Unfortunately, different screen readers support different attributes, so none of them can be relied on as a single solution. Alternatively, you can convey the relationship between elements by using thearia-labelledby and aria-descibedby attributes.
Quick Fixes
1 <div class="tabs">2 <div role="tablist" aria-label="a list of tabs">3 <button role="tab"4 aria-selected="true"5 aria-controls="tab-content-1"6 id="tab-1">7 First Tab8 </button>9 <button role="tab"10 aria-selected="false"11 aria-controls="tab-content-2"12 id="tab-2">13 Second tab14 </button>15 <button role="tab"16 aria-selected="false"17 aria-controls="tab-content-2"18 id="tab-3">19 Third tab20 </button>21 </div>22 <div tabindex="0"23 role="tabpanel"24 id="tab-content-1"25 aria-labelledby="tab-1">26 <!-- Tab Content -->27 </div>28 <div tabindex="0"29 role="tabpanel"30 id="tab-content-2"31 aria-labelledby="tab-2"32 hidden="">33 <!-- Tab Content -->34 </div>35 <div tabindex="0"36 role="tabpanel" i37 d="tab-content-3"38 aria-labelledby="tab-3"39 hidden="">40 <!-- Tab Content -->41 </div>42 </div>
1 <label for="op-input" id="op-label">2 Choose One Option3 </label>45 <div>6 <div role="combobox"7 aria-expanded="false"8 aria-owns="op-listbox"9 aria-haspopup="listbox">1011 <input type="text"12 aria-autocomplete="list"13 aria-controls="op-listbox"14 id="op-input" />15 </div>1617 <ul aria-labelledby="op-label"18 role="listbox"19 id="op-listbox">20 </ul>21 </div>
How Users Are Affected
When the relationship between distinct UI elements is not implied in the code, it makes it difficult for screen reader users to get a clear and accurate mental image of the UI. This might confuse, disorient and even prevent the user from using some features.
WCAG Success criteria
This issue might cause elements to fail one or more of the following Success criteria:
1.3.1 info and relationships (A)