Element.ariaColIndex is an instance property that reflects the aria-colindex attribute. Learn how it declares a cell or header’s 1-based column position within a table, grid, or treegrid, how it pairs with ariaColCount, and how to get or set it from JavaScript—with five examples and try-it labs.
01
Kind
Instance property
02
Type
String (integer)
03
Meaning
1-based column position
04
Reflects
aria-colindex
05
Status
Baseline widely
06
Used on
Cells / headers
Fundamentals
Introduction
When a table or grid shows only some columns (or reorders them), assistive technologies still need to know which logical column a cell belongs to.
That is what aria-colindex communicates. The DOM property ariaColIndex lets you read and update that position from JavaScript.
JavaScript
const el = document.getElementById("role-heading");
console.log(el.ariaColIndex); // "1"
el.ariaColIndex = "2";
💡
Beginner tip
Indexes are 1-based strings ("1", "2", …), not 0-based Numbers. Use ariaColCount on the table for the total width.
Concept
Understanding the Property
MDN: the ariaColIndex property of the Element interface reflects the value of the aria-colindex attribute, which defines an element’s column index or position with respect to the total number of columns within a table, grid, or treegrid.
Reflected attribute — mirrors aria-colindex.
Get / set — readable and writable string integer.
1-based — first column is "1".
Baseline — widely available since October 2023 (MDN).
Foundation
📝 Syntax
JavaScript
ariaColIndex
Value
A string which contains an integer (the column position).
Item
Detail
Type
string containing an integer (e.g. "1")
Reflects
aria-colindex
Applies to
Cells / headers in table, grid, treegrid patterns
Often paired with
aria-colcount, aria-rowindex
Pattern
📋 Column Header Index (MDN Shape)
MDN sets aria-colindex="1" on the first column header, then updates it to "2" with the property:
JavaScript
<table id="semantic-table" role="table" aria-label="Semantic Elements" aria-rowcount="100">
<caption>Semantic Elements to use instead of ARIA's roles</caption>
<thead role="rowgroup">
<tr role="row">
<th
role="columnheader"
id="role-heading"
aria-rowindex="1"
aria-colindex="1">
ARIA Role
</th>
<th role="columnheader" id="element-heading" aria-rowindex="1">
Semantic Element
</th>
</tr>
</thead>
</table>
Related property: ariaColCount declares the total number of columns on the container.
Cheat Sheet
⚡ Quick Reference
Goal
Code / note
Read
el.ariaColIndex
Write
el.ariaColIndex = "2"
HTML attribute
aria-colindex="1"
Total columns
table.ariaColCount (container)
MDN status
Baseline Widely available
Snapshot
🔍 At a Glance
Four facts about Element.ariaColIndex.
Kind
get / set
Instance
Type
string
Integer text
Reflects
aria-colindex
Attribute
Baseline
widely
Oct 2023+
Hands-On
Examples Gallery
Examples follow MDN Element: ariaColIndex. Labs use a table header so you can safely read and write the property.
📚 Getting Started
Read the reflected value and follow MDN’s header update.
Example 1 — Read ariaColIndex
Log the column index from a column header.
JavaScript
const el = document.getElementById("role-heading");
console.log(el.ariaColIndex);
// HTML includes: aria-colindex="1"
Prefer ariaColIndex in script; keep the attribute for HTML markup.
Example 5 — Support Snapshot
Feature-detect and remember the 1-based rule.
JavaScript
console.log({
supported: "ariaColIndex" in Element.prototype,
tip: "1-based string integer (first column is \"1\")",
pairsWith: "ariaColCount on the table/grid",
status: "Baseline Widely available (MDN)"
});
Element.ariaColIndex is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.
Internet ExplorerNo ariaColIndex IDL — use setAttribute
No
ariaColIndexBaseline
Bottom line: Use ariaColIndex to get/set aria-colindex on cells and headers. Keep 1-based string integers aligned with ariaColCount on the table/grid, especially for virtualized columns.
Wrap Up
Conclusion
ariaColIndex reflects aria-colindex so cells and headers can declare their 1-based column position within a table, grid, or treegrid. Use it with ariaColCount when the full column set is larger than what the DOM currently shows.
Exceed the declared ariaColCount without updating it
Treat the value as a Number type in ARIA APIs
Skip accessible names / captions on complex tables
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about ariaColIndex
Reflected aria-colindex string for column position.
5
Core concepts
📄01
Get / set
on Element
Kind
📝02
String integer
1-based index
Type
🔍03
Cells / headers
table / grid
Use
✅04
Baseline
widely available
Status
🎯05
With colcount
position in total
Pair
❓ Frequently Asked Questions
It reflects the aria-colindex attribute as a string integer that defines an element’s column index or position with respect to the total number of columns in a table, grid, or treegrid.
No. MDN marks Element.ariaColIndex as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
A string that contains an integer (for example "1" or "2"), not a Number type.
ARIA column indexes are 1-based. The first column is "1", the second is "2", and so on.
ariaColCount is the total number of columns on the table/grid. ariaColIndex is the position of a specific cell or header within that total.
Yes. Reading and writing ariaColIndex updates the reflected aria-colindex attribute.
Did you know?
MDN’s demo updates ariaColIndex on a column header from "1" to "2"—the same string-integer pattern used for aria-rowindex on rows and cells.