Element.ariaSort is an instance property that reflects the aria-sort attribute. Learn the ascending, descending, none, and other values, how sortable column headers use it, and how to get or set the property from JavaScript—with five examples and try-it labs.
01
Kind
Instance property
02
Type
String
03
Values
ascending · descending · none · other
04
Reflects
aria-sort
05
Status
Baseline widely
06
Used on
Column headers
Fundamentals
Introduction
Data tables often let users click a column header to sort rows—A–Z, Z–A, newest first, and so on. Assistive technologies need to know which column is sorted and in which direction.
aria-sort carries that signal on a column header. ariaSort is the JavaScript reflection of that attribute.
JavaScript
const el = document.getElementById("role-heading");
console.log(el.ariaSort); // "none"
el.ariaSort = "ascending";
💡
Beginner tip
When one column becomes sorted, set its ariaSort to ascending or descending, and set other sortable headers back to none. Match the visual sort arrow too.
Concept
Understanding the Property
MDN: the ariaSort property of the Element interface reflects the value of the aria-sort attribute, which indicates if items in a table or grid are sorted in ascending or descending order.
Reflected attribute — mirrors aria-sort.
Get / set — readable and writable string.
Four tokens — ascending, descending, none, other.
Baseline — widely available since October 2023 (MDN).
Foundation
📝 Syntax
JavaScript
ariaSort
Value
A string with one of the following values:
Value
Meaning (MDN)
"ascending"
Items are sorted in ascending order by this column.
"descending"
Items are sorted in descending order by this column.
"none"
There is no defined sort applied to the column.
"other"
A sort algorithm other than ascending or descending has been applied.
⚠️
Sort the data, then announce it
ariaSort does not sort the rows by itself. Your script (or server) must reorder the data; ariaSort only tells assistive technologies which sort is active.
Pattern
📋 MDN Column Header Shape
MDN starts with a column header marked aria-sort="none", then updates it to "ascending" with the property:
JavaScript
<th
role="columnheader"
id="role-heading"
aria-sort="none"
aria-rowindex="1"
aria-colindex="1">
ARIA Role
</th>
JavaScript
let el = document.getElementById("role-heading");
console.log(el.ariaSort); // "none"
el.ariaSort = "ascending";
console.log(el.ariaSort); // "ascending"
Assigning the property updates the reflected aria-sort attribute so assistive technologies hear the new sort direction. Also reorder the table rows to match.
📈 Toggle Direction, Attribute Sync & Snapshot
Practice ascending/descending and verify reflection.
Example 3 — Toggle Ascending / Descending
Flip sort direction on a second click (common UI pattern).
JavaScript
const el = document.createElement("th");
el.setAttribute("role", "columnheader");
el.setAttribute("aria-sort", "ascending");
el.textContent = "Name";
document.body.appendChild(el);
el.ariaSort = el.ariaSort === "ascending" ? "descending" : "ascending";
console.log({
ariaSort: el.ariaSort,
tip: "Clear other headers to none when this one becomes active"
});
{
"ariaSort": "descending",
"tip": "Clear other headers to none when this one becomes active"
}
How It Works
Toggle between ascending and descending on the active column. Keep sibling headers at none unless you intentionally support multi-column sort (then consider other).
Example 4 — Property vs getAttribute
Confirm the attribute stays in sync after a write.
Prefer ariaSort in script; keep the attribute for HTML markup.
Example 5 — Support Snapshot
Feature-detect and list the allowed tokens.
JavaScript
console.log({
supported: "ariaSort" in Element.prototype,
allowed: ["ascending", "descending", "none", "other"],
tip: "Sort the rows in the DOM; ariaSort only announces the state",
status: "Baseline Widely available (MDN)"
});
{
"supported": true,
"allowed": ["ascending", "descending", "none", "other"],
"tip": "Sort the rows in the DOM; ariaSort only announces the state",
"status": "Baseline Widely available (MDN)"
}
How It Works
Do not let ARIA sort disagree with the visible order or sort icons—mismatched sort state confuses AT users.
Applications
🚀 Common Use Cases
Sortable data tables and ARIA grids.
Announcing A–Z vs Z–A when a header is clicked.
Clearing other columns to none when a new sort becomes active.
Marking custom sort modes with other.
Keeping script and markup aligned without manual setAttribute.
Under the Hood
🔧 How It Works
1
User clicks a header
Or activates it with keyboard.
Input
2
Rows are reordered
Your code sorts the data in the table/grid.
Data
3
ariaSort updates
Active header gets ascending/descending; others none.
State
4
✓
Assistive tech announces sort
Users hear which column is sorted and how.
Important
📝 Notes
Not Deprecated, Experimental, or Non-standard on MDN (Baseline Widely available).
Value is a string: ascending, descending, none, or other.
ariaSort announces sort—it does not sort the DOM by itself.
Element.ariaSort is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.
Internet ExplorerNo ariaSort IDL — use setAttribute
No
ariaSortBaseline
Bottom line: Use ariaSort on columnheaders to announce table/grid sort direction. Keep only one active sort column when that matches your UI. Sort the data yourself; ariaSort only reflects the state.
Wrap Up
Conclusion
ariaSort reflects aria-sort so column headers can declare how a table or grid is sorted. Use the string tokens, keep visuals in sync, and always sort the underlying rows when the state changes.
Leave multiple columns as ascending/descending by mistake
Invent custom token spellings
Forget to update sort after a new click
Hide sort state from sighted users only
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about ariaSort
Reflected aria-sort string for table/grid column sort direction.
5
Core concepts
📄01
Get / set
on Element
Kind
📝02
String tokens
4 allowed values
Type
🔍03
Columnheader
table / grid
Use
✅04
Baseline
widely available
Status
🎯05
Announce only
you sort the data
Tip
❓ Frequently Asked Questions
It reflects the aria-sort attribute as a string that indicates whether items in a table or grid are sorted in ascending or descending order (or none/other) for that column header.
No. MDN marks Element.ariaSort as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
One of the strings "ascending", "descending", "none", or "other".
On columnheader elements in a table or grid that users can sort. Usually only one column is actively sorted at a time.
A sort algorithm other than ascending or descending has been applied (for example a custom or multi-key sort).
Yes. Reading and writing ariaSort updates the reflected aria-sort attribute.
Did you know?
MDN’s demo puts aria-sort on a real role="columnheader" inside a semantic ARIA table—so sort state lives on the header that users activate, not on the table root.