Custom labels
Labels change status announcements without changing the table's semantic structure or keyboard interaction.
Option demo
This incident queue uses JavaScript options when sorting rules need functions: custom parser order, a custom state sorter, domain labels, and a visible status region.
Scenario
Priority and impact use numeric parser maps, while State uses a custom sorter so active incidents appear before waiting or resolved work.
Try it
Example
Sort status will appear here.
Scroll horizontally to view all incident columns.
| INC-2048 | Sev 1 | Global | Investigating | 42 min |
| INC-2047 | Sev 3 | Team | Waiting | 2 hr |
| INC-2046 | Sev 2 | Region | Mitigating | 75 min |
| INC-2045 | Sev 1 | Region | Resolved | 4 hr 20 min |
| INC-2044 | Sev 4 | Single user | Investigating | 18 min |
Developer notes
const instance = createSortableTable(table, {
statusElement: "#incident-sort-status",
allowUnsort: true,
customParsers: {
priority(value) {
return { "sev 1": 1, "sev 2": 2, "sev 3": 3, "sev 4": 4 }[value.toLowerCase()] ?? 99;
},
impact(value) {
return { global: 1, region: 2, team: 3, "single user": 4 }[value.toLowerCase()] ?? 99;
}
},
customSorters: {
state(rowA, rowB, context) {
return stateOrder(context.getValue(rowA)) - stateOrder(context.getValue(rowB));
}
},
labels: {
sortedBy: "Incident queue sorted by {label}, {direction}.",
unsorted: "Incident queue returned to original order for {label}."
}
});
Accessibility notes
Labels change status announcements without changing the table's semantic structure or keyboard interaction.
The status element is visible and polite, so sighted testers and assistive technology users can confirm the same state change.
Custom sort functions should stay deterministic and should not depend on visual-only state.