Skip to main content
cngx-src documentation

CNGX_ORGANISM_SCROLL_SYNC_FACTORY

Tokenv0.1.0WCAG AA

InjectionToken<CngxOrganismScrollSyncFactory>

Description#

DI token for the active-item scroll-into-view policy.
The default, createOrganismScrollSync, scrolls the active tab's header into view on every activeId change.
Override the whole policy to swap the scroll behaviour, target a different selector, add telemetry, opt out of motion, or disable it entirely.

Provided in root with the default factory, so consumers override only when they need to. \

Sibling to

  • CNGX_DOM_ANCHOR_RETRY_FACTORY and
  • CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY.
// Honour prefers-reduced-motion app-wide:
providers: [
  {
    provide: CNGX_ORGANISM_SCROLL_SYNC_FACTORY,
    useValue: (opts) =>
      createOrganismScrollSync({ ...opts, scrollOptions: { behavior: 'auto' } }),
  },
];
// Or disable scroll-into-view entirely: useValue: () => {}

Type#

InjectionToken<CngxOrganismScrollSyncFactory>

Provided in#

'root'