Wagtail client-side components
    Preparing search index...

    Allows a target element (either via href or the targetValue as a selector) to be focused. If the element does not have a tabindex attribute, it will be added and removed when the element loses focus.

    Useful for the skip link functionality, which appears at the top left corner of the admin when the tab button is clicked. Used to provide an accessible skip button for keyboard control so that users can easily navigate to the main content without having to navigate a long list of navigation links. Inspired by https://github.com/selfthinker/dokuwiki_template_writr/blob/master/js/skip-link-focus-fix.js

    <a href="#main" data-controller="w-focus" data-action="w-focus#focus:prevent">Skip to main content</a>
    
    <section>
    <div class="section-top"><h3>Section title</h3></div>
    <p>...lots of content...</p>
    <button type="button" data-controller="w-focus" data-w-focus-target-value=".section-top" data-action="w-focus#focus">Skip to top</button>
    </section>

    Hierarchy

    Index

    Constructors

    • Parameters

      • context: Context

      Returns FocusController

    Properties

    context: Context
    targetValue: string
    blessings: (<T>(constructor: Constructor<T>) => any)[]
    outlets: string[]
    targets: string[]
    values: { target: StringConstructor } = ...

    Accessors

    • get application(): Application

      Returns Application

    • get classes(): ClassMap

      Returns ClassMap

    • get data(): DataMap

      Returns DataMap

    • get element(): ElementType

      Returns ElementType

    • get identifier(): string

      Returns string

    • get outlets(): OutletSet

      Returns OutletSet

    • get scope(): Scope

      Returns Scope

    • get targets(): TargetSet

      Returns TargetSet

    • get shouldLoad(): boolean

      Returns boolean

    Methods

    • Returns void

    • Returns void

    • Parameters

      • eventName: string
      • Optional__namedParameters: Partial<
            {
                bubbles: boolean;
                cancelable: boolean;
                detail: Object;
                prefix: string;
                target: Element
                | Window
                | Document;
            },
        >

      Returns CustomEvent<Object>

    • Returns void

    • Parameters

      • _identifier: string
      • _application: Application

      Returns void