Fix category selector highlighting to use slug comparison

Use top_slug/sub_slug directly instead of current_local_href for
active state detection. The previous approach compared full request
paths against short category-relative paths, which never matched.
This also avoids conflicting with current_local_href used by brand
filter URL construction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-19 15:28:51 +00:00
parent d404349806
commit 98c3df860b

View File

@@ -2,7 +2,7 @@
<nav aria-label="Categories" <nav aria-label="Categories"
class="rounded-xl border bg-white shadow-sm min-h-0"> class="rounded-xl border bg-white shadow-sm min-h-0">
<ul class="divide-y"> <ul class="divide-y">
{% set top_active = (current_local_href == top_local_href) %} {% set top_active = (sub_slug is not defined or sub_slug is none or sub_slug == '') %}
{% set href = (url_for('market.browse.browse_top', top_slug=top_slug) ~ qs)|host %} {% set href = (url_for('market.browse.browse_top', top_slug=top_slug) ~ qs)|host %}
<li> <li>
<a <a
@@ -19,7 +19,7 @@
</li> </li>
{% for sub in subs_local %} {% for sub in subs_local %}
{% set active = (current_local_href == sub.local_href) %} {% set active = (sub.slug == sub_slug) %}
{% set href = (url_for('market.browse.browse_sub', top_slug=top_slug, sub_slug=sub.slug) ~ qs)|host %} {% set href = (url_for('market.browse.browse_sub', top_slug=top_slug, sub_slug=sub.slug) ~ qs)|host %}
<li> <li>
<a <a