Class: PhlexKit::MenubarMenu

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/menubar/menubar_menu.rb

Overview

One trigger+panel pair in a Menubar. See menubar.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ MenubarMenu

Returns a new instance of MenubarMenu.



4
# File 'app/components/phlex_kit/menubar/menubar_menu.rb', line 4

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

Instance Method Details

#view_templateObject



5
6
7
8
9
10
11
12
13
# File 'app/components/phlex_kit/menubar/menubar_menu.rb', line 5

def view_template(&)
  base = { class: "pk-menubar-menu", data: { phlex_kit__menubar_target: "menu" } }
  # role="none": role="menubar" only allows menuitem children in the
  # accessibility tree — this layout wrapper must be presentational so
  # the tree flattens to menubar > menuitem (axe: required-children).
  # Default only when the caller didn't supply their own — `mix` fuses.
  base[:role] = "none" unless attr_set?(:role)
  div(**mix(base, @attrs), &)
end