Skip to content

Keep pannel close button accessible with external styles #2128

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

Merged
merged 3 commits into from
Apr 27, 2025
Merged
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: 1 addition & 1 deletion debug_toolbar/static/debug_toolbar/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function ajax(url, init) {
})
.catch((error) => {
const win = document.getElementById("djDebugWindow");
win.innerHTML = `<div class="djDebugPanelTitle"><button type="button" class="djDebugClose">»</button><h3>${error.message}</h3></div>`;
win.innerHTML = `<div class="djDebugPanelTitle"><h3>${error.message}</h3><button type="button" class="djDebugClose">»</button></div>`;
$$.show(win);
throw error;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{% if panel.has_content and panel.enabled %}
<div id="{{ panel.panel_id }}" class="djdt-panelContent djdt-hidden">
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">×</button>
<h3>{{ panel.title }}</h3>
<button type="button" class="djDebugClose">×</button>
</div>
<div class="djDebugPanelContent">
{% if toolbar.should_render_panels %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">»</button>
<h3>{% translate "SQL explained" %}</h3>
<button type="button" class="djDebugClose">»</button>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">»</button>
<h3>{% translate "SQL profiled" %}</h3>
<button type="button" class="djDebugClose">»</button>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">»</button>
<h3>{% translate "SQL selected" %}</h3>
<button type="button" class="djDebugClose">»</button>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">»</button>
<h3>{% translate "Template source:" %} <code>{{ template_name }}</code></h3>
<button type="button" class="djDebugClose">»</button>
</div>
<div class="djDebugPanelContent">
<div class="djdt-scroll">
Expand Down
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Pending
template loaders.
* Introduced `djade <https://github.com/adamchainz/djade>`__ to format Django
templates.
* Swapped display order of panel header and close button to prevent style
conflicts

5.1.0 (2025-03-20)
------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/panels/test_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def test_escapes_panel_title(self):
"""
<div id="CustomPanel" class="djdt-panelContent djdt-hidden">
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">×</button>
<h3>Title with special chars &amp;&quot;&#39;&lt;&gt;</h3>
<button type="button" class="djDebugClose">×</button>
</div>
<div class="djDebugPanelContent">
<div class="djdt-loader"></div>
Expand Down
2 changes: 1 addition & 1 deletion tests/panels/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def test_panel_title(self):
"""
<div id="SettingsPanel" class="djdt-panelContent djdt-hidden">
<div class="djDebugPanelTitle">
<button type="button" class="djDebugClose">×</button>
<h3>Settings from None</h3>
<button type="button" class="djDebugClose">×</button>
</div>
<div class="djDebugPanelContent">
<div class="djdt-loader"></div>
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ def test_displays_server_error(self):
debug_window = self.selenium.find_element(By.ID, "djDebugWindow")
self.selenium.find_element(By.CLASS_NAME, "BuggyPanel").click()
self.wait.until(EC.visibility_of(debug_window))
self.assertEqual(debug_window.text, "»\n500: Internal Server Error")
self.assertEqual(debug_window.text, "500: Internal Server Error\n»")

def test_toolbar_language_will_render_to_default_language_when_not_set(self):
self.get("/regular/basic/")
Expand Down