initialize

in app/components/primer/navigation/tab_component.rb [106:139]


      def initialize(list: false, selected: false, with_panel: false, panel_id: "", icon_classes: "", wrapper_arguments: {}, **system_arguments)
        @selected = selected
        @icon_classes = icon_classes
        @list = list
        @with_panel = with_panel

        @system_arguments = system_arguments
        @id = @system_arguments[:id]
        @wrapper_arguments = wrapper_arguments

        if with_panel || @system_arguments[:tag] == :button
          @system_arguments[:tag] = :button
          @system_arguments[:type] = :button
          @system_arguments[:role] = :tab
          panel_id(panel_id)
          
          @wrapper_arguments[:role] = :presentation
        else
          @system_arguments[:tag] = :a
        end

        @wrapper_arguments[:tag] = :li
        @wrapper_arguments[:display] ||= :inline_flex

        return unless @selected

        if @system_arguments[:tag] == :a
          aria_current = aria("current", system_arguments) || DEFAULT_ARIA_CURRENT_FOR_ANCHOR
          @system_arguments[:"aria-current"] = fetch_or_fallback(ARIA_CURRENT_OPTIONS_FOR_ANCHOR, aria_current, DEFAULT_ARIA_CURRENT_FOR_ANCHOR)
        else
          @system_arguments[:"aria-selected"] = true
        end
      end