API: Core
resolveDirection
Resolves the effective direction for an element by walking up to the nearest ancestor (including itself) that carries a dir attribute — the same resolution <ht…
Overview
Resolves the effective direction for an element by walking up to the nearest
ancestor (including itself) that carries a dir attribute — the same
resolution <html dir="rtl"> and a subtree-overriding <div dir="rtl"> get
from the browser. Falls back to 'ltr' when nothing in the chain sets it. dir="auto" and
other invalid values are skipped (inherit from the next ancestor).
Deliberately attribute-based rather than getComputedStyle-based: it needs
nothing beyond Element.closest/getAttribute, which server-side DOM
implementations provide too, so this stays correct during SSR without a
document/window guard.
- Kind: Function
- Source: packages/core/src/directionality/directionality.ts:20
Signature
function resolveDirection(element: Element | null | undefined): Direction
| Parameter | Type | Optional | Description |
|---|---|---|---|
element |
Element | null | undefined |
Returns Direction