Fix facet_sort dropdown silently failing to navigate

The onchange handler used `new URL(location)`. Inline event handler
attributes execute inside an implicit `with(document){...}` scope, and
`document.URL` is a built-in string property — so the bare `URL`
identifier resolved to that string instead of the global URL
constructor, throwing "URL is not a constructor" on every change.
The error wasn't visible anywhere in the UI, so the dropdown appeared
to update (its own selected option changed) while the page silently
never navigated, and a reload reverted it to the default.

Fix: reference `window.URL` explicitly to bypass the shadowing.
Verified the dropdown now actually re-sorts the sidebar and the
change survives a reload on both the Links and Prompts pages.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Erik Thiele
2026-07-31 13:02:08 +02:00
parent d13b8ce5bc
commit 547374aa6d
2 changed files with 2 additions and 2 deletions

View File

@@ -12,7 +12,7 @@
</a> </a>
<div style="display:flex; justify-content:flex-end; margin-top:12px;"> <div style="display:flex; justify-content:flex-end; margin-top:12px;">
<select onchange="const u=new URL(location); u.searchParams.set('facet_sort', this.value); location.href=u;" <select onchange="const u=new window.URL(location); u.searchParams.set('facet_sort', this.value); location.href=u;"
title="Sortierung der Kategorie-/Hersteller-Listen" style="font-size:.75rem; padding:3px 6px;"> title="Sortierung der Kategorie-/Hersteller-Listen" style="font-size:.75rem; padding:3px 6px;">
{% for value, label in facet_sort_options.items() %} {% for value, label in facet_sort_options.items() %}
<option value="{{ value }}" {% if facet_sort == value %}selected{% endif %}>{{ label }}</option> <option value="{{ value }}" {% if facet_sort == value %}selected{% endif %}>{{ label }}</option>

View File

@@ -12,7 +12,7 @@
</a> </a>
<div style="display:flex; justify-content:flex-end; margin-top:12px;"> <div style="display:flex; justify-content:flex-end; margin-top:12px;">
<select onchange="const u=new URL(location); u.searchParams.set('facet_sort', this.value); location.href=u;" <select onchange="const u=new window.URL(location); u.searchParams.set('facet_sort', this.value); location.href=u;"
title="Sortierung der Kategorie-Liste" style="font-size:.75rem; padding:3px 6px;"> title="Sortierung der Kategorie-Liste" style="font-size:.75rem; padding:3px 6px;">
{% for value, label in facet_sort_options.items() %} {% for value, label in facet_sort_options.items() %}
<option value="{{ value }}" {% if facet_sort == value %}selected{% endif %}>{{ label }}</option> <option value="{{ value }}" {% if facet_sort == value %}selected{% endif %}>{{ label }}</option>