dynamic-forms-ionic / Function

createAriaDescribedBySignal

Creates a signal that computes the aria-describedby value based on errors and hint state. Errors take precedence over hints - when errors are displayed, the hint is hidden. Only the first error is displayed (single error ID, not indexed).

Presentation

function createAriaDescribedBySignal(
  errorsToDisplay: Signal<ResolvedError[]>,
  errorId: Signal<string>,
  hintId: Signal<string>,
  hasHint: () => boolean,
): Signal<string | null>;

Returns

Signal<string | null> -

Signal containing the aria-describedby value or null

Parameters

NameTypeDescription
errorsToDisplay
Signal<ResolvedError[]>

Signal containing the array of errors currently being displayed

errorId
Signal<string>

Signal containing the ID for the error element (single error only)

hintId
Signal<string>

Signal containing the ID for the hint element

hasHint
() => boolean

Function that returns true if a hint is configured