I am not sure this is possible, but I figured I would ask in public so anyone else could answer, but my guess is that if anyone knows it will be @victordcq lol
Is it possible to create a style that bases itself off of the current URL in some way? I know through some googling there used to be an @document selector in CSS that would enable you to make style classes based off the document title. However it doesn't seem that's still there anymore.
I am trying to automatically apply a style class to a menu item if you are on its target page.
A few other solutions that don't solve the problem today, but could in the longer term:
A binding on the page url, that climbs the menu trees items and updates it that way, but that feels like a hacky workaround not a clean solution.
A feature request to add something like an "on target" style property to each menu item
I just create a binding on each tab style it's a bit crap cause every time you move a tab around or delete them you have to rebind most of them as the index changes.........
I went a similar route but used an event instead of a transform and also incorporated recursion so that there could be a variable depth of child items in the menu:
Probably wasn't clear in initial post, but that was expected to be a recursive transform just like your project function. Yours is better documented though!
You could kinda use :target selector i suppose, and give your button an id
But i'm not sure if you can modify enough stuff in perspective to make that work
I went a somewhat different route to achieve that, but it might be due to some design choices.
Every time navigate is called, I also send a message called page_changed. I need this to update docks (no alterDock function available at the time).
The menu also catches this message and stores in a custom property what page (sent in the payload) is currently displayed. Every item in the menu can then use that to switch its style class.
Instead of on navigate, could you out this on an on change event on the session prop that store the page id? This would be more robust in terms of always catching a change of page