JavaScript Element ariaLabelledByElements Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

In JavaScript, ariaLabelledByElements is an array of elements that provide an accessible name for the element it is applied to (MDN). It reflects aria-labelledby in some cases, but can also point to elements without an id, and takes precedence over other ARIA naming methods.

Read the notes below before you get or set this property. Prefer feature detection when support is limited.

Syntax

Use el.ariaLabelledByElements. Start with this line.

JavaScript
element.ariaLabelledByElements
CallWhat it does
element.ariaLabelledByElementsPrimary signature.

Built into the browser. Read or assign el.ariaLabelledByElements — no import required.

Library declarations
JavaScript
element.ariaLabelledByElements

Parameters

ParameterDescription
Label element(s)Required. Provide the name text
Custom elementsOptional. ElementInternals has the same property

Return Value

Return ValueDescription
*The current value of el.ariaLabelledByElements.

JavaScript Examples

Example 1 — Read Name from aria-labelledby (MDN)

Resolve referenced elements and join their text into the accessible name.

JavaScript
const inputElement = document.querySelector("input");

if ("ariaLabelledByElements" in Element.prototype) {
  const labelElements = inputElement.ariaLabelledByElements;
  const text = labelElements.map((e) => e.textContent.trim()).join(" ");
  console.log("Accessible name:", text.trim());
} else {
  console.log("ariaLabelledByElements not supported");
}
Try It Yourself

How It Works

  1. Feature-detect. Older browsers may lack the property.
  2. Read the array. Elements listed by aria-labelledby (when valid).
  3. Map textContent. Pull visible label text from each element.
  4. Join with spaces. That string is the accessible name (MDN).

Example 2 — Assign Elements (No id Needed)

Point the property at label nodes directly; the attribute is cleared.

JavaScript
const input = document.querySelector("input");
const a = document.getElementById("a");
const b = document.getElementById("b");

if ("ariaLabelledByElements" in Element.prototype) {
  input.ariaLabelledByElements = [a, b];
  console.log(
    "attr after set:",
    input.getAttribute("aria-labelledby")
  ); // null / cleared
}
Try It Yourself

How It Works

  1. Collect label elements. They do not need ids for the property (MDN).
  2. Assign an array. The browser copies it into the property.
  3. Attribute clears. aria-labelledby is removed when the property is set.
  4. Do not mutate later. Changing the original array afterward has no effect.

Example 3 — Feature Detect

Check support before relying on reflected element references.

JavaScript
const ok = "ariaLabelledByElements" in Element.prototype;
console.log(
  ok
    ? "ariaLabelledByElements is supported"
    : "use aria-labelledby / <label> fallback"
);
Try It Yourself

How It Works

  1. Probe the prototype. Cheap capability check.
  2. Branch safely. Keep aria-labelledby / <label> for older engines.
  3. Baseline 2025. Latest browsers support it; older ones may not.
  4. Test with AT. Confirm the announced name matches your joined text.

Browser Support

Element.ariaLabelledByElements is marked Baseline Newly available on MDN (since April 2025). Logos use the shared browser-image-sprite.png sprite from this project.

✓ Baseline · Newly available

Element ariaLabelledByElements

Element-reference array for the accessible name — flexible alternative to aria-labelledby ids.

Newly Available
Google Chrome Supported in recent versions
Supported
Mozilla Firefox Supported in recent versions
Supported
Apple Safari Supported in recent versions
Supported
Microsoft Edge Supported · Chromium
Supported
Opera Supported in recent versions
Supported
Internet Explorer Not supported
Not supported
ariaLabelledByElements Baseline 2025

Bottom line: Safe in latest browsers. Feature-detect and keep aria-labelledby / label fallbacks. See the MDN Element.ariaLabelledByElements reference.

Frequently Asked Questions

An array of elements that provide an accessible name for the element (MDN). Join their inner text with spaces to form the accessible name string.
No. MDN marks Element.ariaLabelledByElements as Baseline 2025 (Newly available since April 2025). It is not Deprecated, Experimental, or Non-standard. Feature-detect on older browsers.
The attribute uses space-separated id strings. The property uses Element references. Assigned elements do not need an id. Setting the property clears the corresponding attribute (MDN).
ariaLabel is a string name on the element itself. ariaLabelledByElements points to other elements whose text becomes the name. Prefer labelled-by when the name already exists as visible text on the page.
Yes. MDN: the property takes precedence over all other methods of setting the ARIA label, including content and associated label elements.
No. When read, the returned array is static and read-only. When written, the assigned array is copied — later changes to that array do not update the property (MDN).

Next: Element ariaLevel

Learn the ARIA property that reflects hierarchical level.

ariaLevel tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful