From 803169816bdddaf934fcb87bd59c2e987a50b332 Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Fri, 9 Jan 2026 12:25:02 +0000 Subject: [PATCH] Replace onclick navigation with proper links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Converts cancel buttons that use onclick="window.location.href='...'" to proper A tags with href. This improves accessibility (keyboard navigation, right-click options) and semantics while maintaining the same button styling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/animaltrack/web/templates/actions.py | 7 +++---- src/animaltrack/web/templates/move.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/animaltrack/web/templates/actions.py b/src/animaltrack/web/templates/actions.py index 47dbfb7..a63ac2a 100644 --- a/src/animaltrack/web/templates/actions.py +++ b/src/animaltrack/web/templates/actions.py @@ -4,7 +4,7 @@ from collections.abc import Callable from typing import Any -from fasthtml.common import H2, H3, Div, Form, Hidden, Input, Option, P, Script, Select, Span +from fasthtml.common import H2, H3, A, Div, Form, Hidden, Input, Option, P, Script, Select, Span from monsterui.all import ( Alert, AlertT, @@ -86,11 +86,10 @@ def diff_confirmation_panel( Hidden(name="confirmed", value="true"), Hidden(name="nonce", value=str(ULID())), Div( - Button( + A( "Cancel", - type="button", + href=cancel_url, cls=ButtonT.default, - onclick=f"window.location.href='{cancel_url}'", ), Button( confirm_button_text, diff --git a/src/animaltrack/web/templates/move.py b/src/animaltrack/web/templates/move.py index b96eebc..2df919d 100644 --- a/src/animaltrack/web/templates/move.py +++ b/src/animaltrack/web/templates/move.py @@ -4,7 +4,7 @@ from collections.abc import Callable from typing import Any -from fasthtml.common import H2, Div, Form, Hidden, Option, P, Select, Span +from fasthtml.common import H2, A, Div, Form, Hidden, Option, P, Select, Span from monsterui.all import Alert, AlertT, Button, ButtonT, FormLabel, LabelInput, LabelTextArea from ulid import ULID @@ -253,11 +253,10 @@ def diff_panel( Hidden(name="confirmed", value="true"), Hidden(name="nonce", value=str(ULID())), Div( - Button( + A( "Cancel", - type="button", + href="/move", cls=ButtonT.default, - onclick="window.location.href='/move'", ), Button( f"Confirm Move ({diff.server_count} animals)",