MAIDR Documentation - v3.72.1
    Preparing search index...
    • Finds the Victory data elements inside a container for a given layer, tags them with a unique data attribute, and returns the CSS selector that matches exactly those elements.

      Strategy:

      1. Victory renders each data component's elements with role="presentation" on the individual data shapes.
      2. We query for the expected SVG tag (e.g. rect for bars) that carries role="presentation".
      3. We skip elements that belong to other layers by tracking which elements were already claimed.
      4. Each claimed element receives a data-maidr-victory-<layerIndex> attribute so MAIDR can select them deterministically.

      Parameters

      • svg: SVGElement

        The panel's root svg element

      • layer: VictoryLayerInfo

        The extracted layer info

      • layerIndex: number

        Numeric index for generating unique attribute names

      • claimed: Set<Element>

        Set of elements already claimed by prior layers of the same panel (must not be shared across panels)

      • scope: string

        Per-chart (and, in multi-panel mode, per-panel) CSS scope prefix that disambiguates this panel's selectors page-wide

      • panelIndex: number | null = null

        Panel index in multi-panel mode; null keeps the original single-panel attribute naming

      Returns string | CandlestickSelector | BoxSelector[] | undefined

      A CSS selector string, or undefined if elements could not be matched (highlighting will gracefully degrade).

      This relies on Victory's role="presentation" attribute on data elements, which is a stable Victory convention (tested with v37). If Victory changes this convention, selector tagging will silently degrade and highlighting will stop working (audio/text/braille are unaffected).

      The emitted selectors are prefixed with scope (e.g. #<containerId> , or #<containerId> [data-maidr-victory-panel="i"] in multi-panel mode) so that MAIDR — which resolves selectors via page-global document.querySelector — cannot match another Victory chart's (or panel's) identically-indexed tags. The per-element tag attributes only need to be unique within their own container, which scope plus the panel-folded names guarantee.