Skip to content

@jsvision/ui / reportDuplicateAccelerators

Function: reportDuplicateAccelerators()

reportDuplicateAccelerators(scope, chars, labels?): void

Defined in: ui/src/menu/accelerators.ts:68

Run findDuplicateAccelerators over a scope's accelerator chars and emit one dev-only warning per collision (silent under NODE_ENV=production). When labels is supplied (parallel to chars), the message names the colliding entries; otherwise it names the char and the claim count.

Parameters

scope

string

The subsystem tag for the warning prefix ('menu', 'dialog', 'tabs').

chars

readonly string[]

One accelerator char (or '') per scope entry, in scope order.

labels?

readonly string[]

Optional display labels parallel to chars, used to name the colliding entries.

Returns

void

Example

ts
import { reportDuplicateAccelerators } from '@jsvision/ui';

// Warns once (in development): duplicate accelerator 'x' — "Exit", "Export" share it …
reportDuplicateAccelerators('menu', ['x', '', 'x'], ['Exit', '', 'Export']);