From c76b0feeaac2cc40a13d348d706f96b42bf02afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Debois?= Date: Wed, 3 Aug 2016 23:49:16 +0200 Subject: [PATCH] Render Dialog element only when dialog tab is active --- demo/Demo.elm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/demo/Demo.elm b/demo/Demo.elm index fdb412a..8db8834 100644 --- a/demo/Demo.elm +++ b/demo/Demo.elm @@ -317,10 +317,17 @@ view' model = , Html.node "script" [ Html.Attributes.attribute "src" "assets/highlight.pack.js" ] [] - , App.map DialogMsg (Demo.Dialog.element model.dialog) - {- Because of limitations on browsers that have non-native (polyfilled) - elements, our dialog element /may/ have to sit up here. - -} + , case nth model.selectedTab tabs of + Just ( "Dialog", _, _ ) -> + App.map DialogMsg (Demo.Dialog.element model.dialog) + {- Because of limitations on browsers that have non-native (polyfilled) + elements, our dialog element /may/ have to sit up here. However, + running in elm-reactor will never load the polyfill, so we render the + dialog (wrongly if there is no polyfill) only when the Dialog tab is + active. + -} + _ -> + div [] [] ] )