# wrGetFocusableElements

> Lists the focusable descendants of an element, in DOM order.

Source: https://ngwr.dev/reference/utils/wr-get-focusable-elements  
Kind: Util  
Updated in v16  
Optional

## Usage

```angular-ts
import { wrGetFocusableElements } from 'ngwr/utils';

const els = wrGetFocusableElements(menuRef.nativeElement);
els[0]?.focus();
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `wrGetFocusableElements(root)` | Every focusable descendant of `root`, in DOM order. Skips disabled and `tabindex="-1"` elements, and unrendered ones unless they hold focus. A positive `tabindex` is not sorted. | `(root: HTMLElement) => readonly HTMLElement[]` | `—` |

## See also

- [wrTrapFocus](https://ngwr.dev/reference/utils/wr-trap-focus) — Keeps Tab and Shift+Tab cycling inside a container, such as a dialog.
- [Overlay](https://ngwr.dev/guides/overlay) — Style ngwr's floating panels and control where focus goes.
- [wrAutofocus](https://ngwr.dev/reference/directives/autofocus) — Focus an element on init, or each time a binding turns true.
