Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "index"

Index

Type aliases

Hash

Hash: string

A hash fragment.

ScrollPosition

ScrollPosition: object

The scroll position as x and y coordinates.

Type declaration

Selector

Selector: string

A CSS selector.

Target

Target: Element | Selector

Specifies an element that is the target of a side effect (e.g. scroll into view, focus). This is either the element itself or a selector that will return the element when passed to querySelector().

Functions

Const announce

  • announce(message: string, announcementsDivId?: string): void

Const elementFromHash

  • elementFromHash(hash: Hash): Element | undefined

Const elementFromTarget

  • elementFromTarget(target: Target, parent?: ParentNode): Element | undefined
  • Parameters

    • target: Target
    • Default value parent: ParentNode = document

    Returns Element | undefined

Const focusAndScrollIntoViewIfRequired

  • focusAndScrollIntoViewIfRequired(focusTarget: Target, scrollIntoViewTarget: Target, focusOptions?: FocusOptions, scrollIntoViewOptions?: ScrollIntoViewOptions): Promise<boolean>
  • Focuses a specified element and then scrolls it (or another element) into view (if required).

    For smooth scrolling behavior you might want to use the smoothscroll polyfill http://iamdustan.com/smoothscroll/

    Parameters

    • focusTarget: Target
    • scrollIntoViewTarget: Target
    • Optional focusOptions: FocusOptions
    • Optional scrollIntoViewOptions: ScrollIntoViewOptions

    Returns Promise<boolean>

Const focusElement

  • focusElement(target: Target, options?: FocusOptions): Promise<boolean>

Const focusInvalidForm

  • focusInvalidForm(formSelector: Selector, invalidElementSelector: Selector, formGroupSelector: Selector, focusOptions?: FocusOptions, scrollIntoViewOptions?: ScrollIntoViewOptions): Promise<boolean>
  • Focuses and scrolls into view the first invalid form element inside a given form.

    For IE support you might want to use the closest() polyfill from https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill

    Parameters

    • formSelector: Selector

      a CSS selector that uniquely identifies the form to focus, e.g. #search-form.

    • invalidElementSelector: Selector

      the CSS selector that is used to identify invalid elements within a form, e.g. [aria-invalid="true"].

    • formGroupSelector: Selector

      a CSS selector passed to the closest() method of an invalid form input that identifies the element that contains both the form input and its label. This form group element will be scrolled into view so that both the input and its label are visible.

    • Optional focusOptions: FocusOptions
    • Optional scrollIntoViewOptions: ScrollIntoViewOptions

    Returns Promise<boolean>

Const getScrollPosition

Const isInViewport

  • isInViewport(element: Element): boolean

Const resetFocus

  • resetFocus(primaryFocusTarget: Selector, focusTarget?: Target, focusOptions?: FocusOptions, scrollIntoViewOptions?: ScrollIntoViewOptions): Promise<boolean>
  • Resets focus after a SPA page navigation.

    See: https://github.com/ReactTraining/react-router/issues/5210

    Parameters

    • primaryFocusTarget: Selector

      a CSS selector for your primary focus target, e.g. [main h1]. This is the element that will receive focus after SPA navigation. If this element does not exist the document body will be used as a fallback.

    • Optional focusTarget: Target
    • Optional focusOptions: FocusOptions
    • Optional scrollIntoViewOptions: ScrollIntoViewOptions

    Returns Promise<boolean>

Const scrollIntoViewIfRequired

  • scrollIntoViewIfRequired(target: Target, options?: ScrollIntoViewOptions, inViewport?: undefined | function): void
  • Scrolls an element into view if it is not currently visible.

    For smooth scrolling behavior you might want to use the smoothscroll polyfill http://iamdustan.com/smoothscroll/

    Parameters

    • target: Target

      the element to scroll into view

    • Optional options: ScrollIntoViewOptions

      controls how the scroll is executed

    • Optional inViewport: undefined | function

    Returns void

Const setScrollPosition

Const setTitle

  • setTitle(title: string): void

Generated using TypeDoc