diff --git a/src/Nri/Ui/SegmentedControl/V14.elm b/src/Nri/Ui/SegmentedControl/V14.elm index 585120a3..9e1e57ac 100644 --- a/src/Nri/Ui/SegmentedControl/V14.elm +++ b/src/Nri/Ui/SegmentedControl/V14.elm @@ -206,6 +206,7 @@ view config = , tabView = [ viewIcon option.icon, option.label ] , panelView = option.content , spaHref = Maybe.map (\toUrl -> toUrl option.value) config.toUrl + , disabled = False } { tabList, tabPanels } = diff --git a/src/TabsInternal/V2.elm b/src/TabsInternal/V2.elm index 7c834f01..9af14867 100644 --- a/src/TabsInternal/V2.elm +++ b/src/TabsInternal/V2.elm @@ -44,6 +44,7 @@ type alias Tab id msg = , tabView : List (Html msg) , panelView : Html msg , spaHref : Maybe String + , disabled : Bool } @@ -59,6 +60,7 @@ fromList { id, idString } attributes = , tabView = [] , panelView = Html.text "" , spaHref = Nothing + , disabled = False } in List.foldl (\applyAttr acc -> applyAttr acc) defaults attributes @@ -125,6 +127,7 @@ viewTab_ config index tab = ++ tagSpecificAttributes ++ tab.tabAttributes ++ [ Attributes.tabindex tabIndex + , Attributes.disabled tab.disabled , Widget.selected isSelected , Role.tab , Attributes.id (tabToId tab.idString) @@ -160,7 +163,13 @@ keyEvents { focusAndSelect, tabs } thisTab keyCode = acc ( True, Nothing ) -> - ( True, Just { select = tab.id, focus = Just (tabToId tab.idString) } ) + ( True + , if tab.disabled then + Just { select = tab.id, focus = Just (tabToId tab.idString) } + + else + Nothing + ) ( False, Nothing ) -> ( tab.id == thisTab.id, Nothing )