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:
@@ -12,7 +12,7 @@
|
||||
</a>
|
||||
|
||||
<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;">
|
||||
{% for value, label in facet_sort_options.items() %}
|
||||
<option value="{{ value }}" {% if facet_sort == value %}selected{% endif %}>{{ label }}</option>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</a>
|
||||
|
||||
<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;">
|
||||
{% for value, label in facet_sort_options.items() %}
|
||||
<option value="{{ value }}" {% if facet_sort == value %}selected{% endif %}>{{ label }}</option>
|
||||
|
||||
Reference in New Issue
Block a user