I have a list of data in a visualisation and I want to make it as accessible as possible. There are two lists next to each other.
The list items has two states. Multiple rows can be active or inactive. A single row could be selected.
Selecting something in one list, will show 'related' items as active, and inactive. See the simplified example below. The user has selected "A 2", which is linked to "B 1" and "B 4", so A2 is aria-selected but there's no aria-active or aria-inactive, I thought to use aria-disabled as demonstrated - BUT does this not indicate that it is not interactable? The user can still click on the disabled item to then select it.
Would it be better to do multiple aria-selected, and a single aria-current=true on the single 'selected' item? Would it be odd that if the user hasn't yet made a selection and everything is 'active', every item will be aria-selected=true?
.container {
display: grid;
grid-template-columns: 200px 200px
}
.list div {
margin: 0.5rem;
background: grey;
}
.list .selected {
background: red;
}
.list .inactive {
opacity: 0.3;
}
<div class="container">
<div class="list">
<div role="row">A 1</div>
<div role="row" class="selected" aria-selected="true">A 2</div>
<div role="row">A 3</div>
<div role="row">A 4</div>
</div>
<div class="list">
<div role="row">B 1</div>
<div role="row" class="inactive" aria-disabled="true">B 2</div>
<div role="row" class="inactive" aria-disabled="true">B 3</div>
<div role="row">B 4</div>
</div>
</div>
Clarifications from comments. Here is how the actual implementation looks with an item selected:
, it's quite complex so I tried to distil it down to the specific issue.
- Like per each list is it one-to-many that may be selected at one time? Only one item can be 'selected', like in the example. Multiple items are 'highlighted' or 'active'. When nothing is selected, they are all 'active'.
- How do the lists correlate to one another? How do they correlate to content they may be providing?
The items have a spline in between, connecting each other that I've given them a
role="presentation". There's actually a timeline inbetween, and things are only 'active' if the items in the timeline share the item in the other list? - If there's content changing to reflect their relationships that may need to consider things like aria-atomic updating dependent upon aria-relevant correlations, etc? I was considering this. The items change only if you scroll, the only thing that changes otherwise is the active/highlight and selected state.
I hadn't considered an aria-label, I think that might be the best solution because the user can click and select the inactive item.