Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SfTrackFocusDirective

API reference for SfTrackFocusDirective

import {SfCommonModule} from "@progress/sitefinity-component-framework";


attribute: sfTrackFocus description: Tracks the focus events of an element

Hierarchy

Implements

  • OnDestroy
  • OnDestroy
  • OnInit

Index

Constructors

constructor

  • Parameters

    • el: ElementRef
    • window: Window

    Returns SfTrackFocusDirective

Properties

Private clickEventListener

clickEventListener: EventListener

Click event listener

closeOnContentClick

closeOnContentClick: boolean = true

Whether to close/focus out on click

closeOnEnterKey

closeOnEnterKey: boolean = true

Whether to close/focus out on pressing of Enter key

closeOnEscape

closeOnEscape: boolean = true

Whether to close/focus out on pressing of Escape key

contentFocusIn

contentFocusIn: EventEmitter<any> = new EventEmitter()

Content focus in emitter

contentFocusOut

contentFocusOut: EventEmitter<any> = new EventEmitter()

Content focus out emitter

Private currentWindow

currentWindow: Window

Holds the current window element

Private documentClickEventListener

documentClickEventListener: EventListener

Document click event listener

Private el

el: ElementRef

Private elMouseDownTriggered

elMouseDownTriggered: boolean = false

Whether the mouseDown event of the element is triggered

Private elMouseUpTriggered

elMouseUpTriggered: boolean = false

Whether the mouseUp event of the element is triggered

focusSubscription

focusSubscription: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false)

Emitted when document click and window keydown event listeners should be added/removed

Private hostEvent

hostEvent: any = null

Holds the event of the clicked element

Private isItemFocused

isItemFocused: boolean = false

Whether the element is focused

Private keydownEventListener

keydownEventListener: EventListener

Key down event listener

Private mouseDownEventListener

mouseDownEventListener: EventListener

Mouse down event listener

Private mouseUpEventListener

mouseUpEventListener: EventListener

Mouse up event listener

Private window

window: Window

windowElement

windowElement: Window

Sets the window element

Methods

Private addEventListeners

  • addEventListeners(): void
  • Adds document click window keydown event listeners

    Returns void

Private callFocusOut

  • callFocusOut(event: Event): void
  • Emits contentFocusOut and removes document click and window keydown event listeners

    Parameters

    • event: Event

    Returns void

ngOnDestroy

  • ngOnDestroy(): void
  • Returns void

ngOnInit

  • ngOnInit(): void
  • Returns void

onDocumentClick

  • onDocumentClick(event: Event): void
  • Handles document click Calls focus out if a click occurs outside of the element

    Parameters

    • event: Event

    Returns void

onDocumentEnterKey

  • onDocumentEnterKey(event: Event): void
  • Handles document enter key Calls focus out on enter if closeEnterKey is true Calls focus out on escape if closeOnEscape is true Calls focus out when tab or shift + tab are pressed

    Parameters

    • event: Event

    Returns void

onElementClick

  • onElementClick(event: Event): void
  • Handles element click Emits focus in if the element is not focused and calls focus out if it is already focused

    Parameters

    • event: Event

    Returns void

onElementMouseDown

  • onElementMouseDown(event: Event): void
  • Handles mouseDown event of element

    Parameters

    • event: Event

    Returns void

onElementMouseUp

  • onElementMouseUp(event: Event): void
  • Handles mouseUp event of element

    Parameters

    • event: Event

    Returns void

Protected registerSubscription

  • registerSubscription(sub: Subscription): void

Private removeEventListeners

  • removeEventListeners(): void
  • Removes document click window keydown event listeners

    Returns void

Protected removeSubsriptions

  • removeSubsriptions(): void

Private resetElementClickFlags

  • resetElementClickFlags(): void
  • Resets mouseDown and mouseUp flags

    Returns void

Generated using TypeDoc