Closed ahri closed 6 years ago
@ahri Do still need an explicit out message as opposed to the latest changes with 3.0.0 (i'e allowing default a href behavior to change the url when clicking on a tab and the possibility to set the hash by specifying it in customInitialState) ? I'd rather not have an outmessage, because it would make the api less nice for cases where people don't use it for deep-linking.
The only scenario I can think of is that if you have hash-based routing for your pages and want an additional level hash (i.e. some custom scheme where you encode levels manually in the hash) ? If so it might be worth considering moving to a more modern approach with proper urls for pages and only use the hashes for tabs (like it's illustrated here: http://elm-bootstrap.info/tab#pillItem2)
Hm you could even avoid hashes all together with nested url's. (http://mysite.com/pagex/tab1
).
I'll upgrade to 3.0.0 soon and come back to this; perhaps there's no real need for it after all.
Hi, first of all great work ... I have also a question concerning the tab-navigation ... would it be possible to add a function like the following
getActiveTab : State -> Maybe String
getActiveTab (State state) =
state.activeTab
To your Tab.elm module? It would ease a lot for me, no need of URL parsing ... etc. ... Or do you have another suggestion of an handy way to get the id of the active tab?
Thanks a lot ...
@andre-dietrich It would be easy, but I'd love to see a use case that merits it (or a hopefully something better). In what circumstance would you "poll" for the id of the active tab and what would you use that information for ?
Just a note; I'm not at all sure that I want anything out of this. I haven't yet upgraded to v3 and it's not high on my priority list at the moment.
Default href behaviour seems to be a much better approach for my SPA :)
@rundis beside deep linking, having a getter or a msg that informs about the current tab can help with saving/restoring state for webapps that want to feel native
Closing this. Open to design suggestions.
Being informed of tab changes would allow me to update the hash of my SPA allowing deep-linking into a tab control: https://ellie-app.com/3h8n9K8tXhva1/1 is an example use-case that currently doesn't work, but illustrates the desired behaviour.