Function: splitAtAccessibleRoleLocator()
splitAtAccessibleRoleLocator(
locator):Optional<{before:PartLocator;roleLocator:AccessibleRoleLocator; }>
Defined in: packages/core/src/utils/locatorUtil.ts:132
Split a locator chain at its AccessibleRoleLocator segment (built by
findByRole) — the second resolution channel that bypasses
toCssSelector entirely, resolving by computed accessible name
instead of CSS (see #923). Returns undefined when the chain has no such
segment — the common, CSS-only case every existing locator takes.
The accessible-role segment must be the chain's LAST element: nothing can
be appended after a name-aware resolution result, since there is no CSS
expression for "descendant of an accname match." before — everything
ahead of it — still resolves normally via toCssSelector and scopes
the accname search to that ancestor's subtree.
Parameters​
locator​
Returns​
Optional<{ before: PartLocator; roleLocator: AccessibleRoleLocator; }>
Throws​
If the segment is present but not the last element of the chain (covers both "something follows it" and "more than one such segment" — the first occurrence not being terminal implies either).