yo! I’ve made my first HA card, this one is more of a utility so you can organize your dashboards.
what does it do
this card places anchors on your dashboard so you can use URL params to navigate to specific spots, like /lovelace/kitchen?anchor=lights. Tried my best to make it customizable, all info in the repo:
Oh, I see. This is a limitation I haven’t thought of, sorry! The current implementation only checks if it should scroll based on the visibility of its parent. It’ll scroll when it first goes into view. Basically I got JavaScript’d and this was the best solution (AFAIK). But this means that navigating within the same view is not possible. I will try to fix this in the upcoming days, appreciate the feedback.
Rewrote the logic, it should be possible to scroll within the same page now! Also the card is no longer dependent on the parent.
nerd explanation: I was able to intercept the history.pushState and history.replaceState methods to call a custom event for location change detection. Home Assistant uses these for navigation. Before, I was only trying to listen to the popstate event, which doesn’t get called this way.
These are my own cards. if you’re interested, I could make them public, but there’s like a thousand other room cards on HACS, so it felt like it’d just be clutter