Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#2993] Use custom page title for zaak detail page #1586

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/open_inwoner/cms/cases/views/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ def get_context_data(self, **kwargs):
api_group = ZGWApiGroupConfig.objects.get(pk=self.kwargs["api_group_id"])
zaken_client = api_group.zaken_client

context["page_title"] = self.case.description

# fetch data associated with `self.case`
documents = self.get_case_document_files(self.case, api_group)
statuses = zaken_client.fetch_status_history(self.case.url)
Expand Down
4 changes: 4 additions & 0 deletions src/open_inwoner/templates/pages/cases/status_inner.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{% load i18n utils anchor_menu_tags card_tags file_tags form_tags grid_tags solo_tags link_tags button_tags icon_tags notification_tags %}

{% block title %}
<title>{% if page_title %}{{ page_title }}{% else %}{% trans "Aanvraag" %}{% endif %}</title>
{% endblock title %}
Comment on lines +3 to +5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wonder whether there's issues of having this in the inner template, for two reasons:

  1. The <title> tag will only appear in the DOM tree after the HTMX has finished loading (which can be a few seconds). I am not sure this change will be properly picked up by screenreaders and announced, but perhaps @jiromaykin knows more here.
  2. I think <title> has to be a child of <head>, having it nested under <body> is probably not valid spec-compliant (not sure that's a show stopper, but again, it might have a11y knock-on effects).

I don't really have a better option, either then setting the title via some kind of HTMX post-load handler (doing it in the main template would defeat the purpose of the async load). Happy to merge this and address it later if it turns out to be a problem.


{# Messages #}
<div class="container container--no-margin" id="cases-status-messages-oob" hx-swap-oob="true">
{% notifications messages closable=True %}
Expand Down
Loading