Class: PhlexKit::ContextMenuTrigger

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/context_menu/context_menu_trigger.rb

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ContextMenuTrigger

Returns a new instance of ContextMenuTrigger.



3
# File 'app/components/phlex_kit/context_menu/context_menu_trigger.rb', line 3

def initialize(**attrs) = (@attrs = attrs)

Instance Method Details

#view_templateObject



4
5
6
7
8
# File 'app/components/phlex_kit/context_menu/context_menu_trigger.rb', line 4

def view_template(&)
  # tabindex 0 so the keyboard context-menu key (Menu / Shift+F10) can
  # reach it, and so Escape has somewhere to return focus to.
  div(**mix({ class: "pk-context-menu-trigger", tabindex: "0", data: { phlex_kit__context_menu_target: "trigger", action: "contextmenu->phlex-kit--context-menu#open" } }, @attrs), &)
end