Element: ariaOwnsElements property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The ariaOwnsElements property of the Element interface is an array containing the element (or elements) that define a visual, functional, or contextual relationship between a parent element that it is applied to, and its child elements. This is used when the DOM hierarchy cannot be used to represent the relationship, and it would not otherwise be available to assistive technology,

The aria-owns topic contains additional information about how the attribute and property should be used.

Value

An array of subclasses of HTMLElement.

When read, the returned array is a static and read-only. When written, the assigned array is copied: subsequent changes to the array do not affect the value of the property.

Description

The property is a flexible alternative to using the aria-owns attribute to indicate ownership of an element. Unlike aria-owns, the elements assigned to this property do not have to have an id attribute.

The property reflects the element's aria-owns attribute when it is defined, but only for listed reference id values that match valid in-scope elements. If the property is set, then the corresponding attribute is cleared. For more information about reflected element references and scope see Reflected element references in the Reflected attributes guide.

Examples

Get the owned element

This example demonstrates how the aria-owns attribute and property are used.

The code defines a menu and its associated submenu in separate and non-nested <div> elements. Because these elements are not nested the ownership relationship between the menu and submenu is not captured by the DOM. Here we provide that information to accessibility tools using the aria-owns attribute, but we could also do it using the reflected property.

Note that we could construct a menu where the submenu was nested: the example has been contrived to make it easier to demonstrate a case where the relationship needs to be defined.

HTML

The HTML defines <div> elements for the menu, with id=parentMenu and the submenu with id="subMenu1". We've added a <div> in between just to make it even more obvious that there is no direct ownership model defined in the DOM.

The parent menu <div> includes the attribute aria-owns="subMenu1" to create this ownership relationship.

html
<div class="menu" id="parentMenu" role="menubar" aria-owns="subMenu1">
  Top level menu (hover over)
</div>

<div>Some other element</div>

<div class="submenu" id="subMenu1" role="menu">
  <a href="#" role="menuitem">Menu item 1</a>
  <a href="#" role="menuitem">Menu item 2</a>
  <a href="#" role="menuitem">Menu item 3</a>
</div>

CSS

The CSS styles the menu and submenu, and displays the submenu when the menu is hovered over.

css
.menu {
  position: relative;
  display: inline-block;
  color: purple;
}

.submenu {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 6px 14px 0px rgb(0 0 0 / 0.2);
  z-index: 1;
  top: 20px;
  left: 0;
}

.menu:hover ~ .submenu {
  display: block;
}

.submenu a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.submenu a:hover {
  background-color: #f1f1f1;
}

JavaScript

The code first checks whether the ariaOwnsElements is supported. If it is, we log the attribute, the elements in the property, and the id value for each element.

js
// Feature test for ariaOwnsElements
if ("ariaOwnsElements" in Element.prototype) {
  const parentMenu = document.querySelector("#parentMenu");
  log(`parentMenu.getAttribute(): ${parentMenu.getAttribute("aria-owns")}`);
  log(`parentMenu.ariaOwnsElements: ${parentMenu.ariaOwnsElements}`);
  parentMenu.ariaOwnsElements?.forEach((elem) => {
    log(`  id: ${elem.id}`);
  });
} else {
  log("element.ariaOwnsElements: not supported by browser");
}

Result

The result of running the code is shown below. The log shows that the relationship defined using the aria-owns attribute is reflected in the ariaOwnsElements property (elements in the array match the attribute element references).

Specifications

Specification
Accessible Rich Internet Applications (WAI-ARIA)
# dom-ariamixin-ariaownselements

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
ariaOwnsElements
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 136 (Release date: 2025-03-04)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – Full support
Firefox for Android 136 (Release date: 2025-03-04)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also