fix settings tabs by using inline style.display instead of CSS class toggling
The class-based is-active/display approach was unreliable due to CSS cascade issues. Switching to direct style.display manipulation bypasses specificity entirely. Also added cache-busting ?v=2 to style.css link. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<link rel="icon" href="{{ url_for('static', filename='favicon.svg') }}" type="image/svg+xml">
|
<link rel="icon" href="{{ url_for('static', filename='favicon.svg') }}" type="image/svg+xml">
|
||||||
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" sizes="any">
|
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" sizes="any">
|
||||||
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon.png') }}">
|
<link rel="apple-touch-icon" href="{{ url_for('static', filename='apple-touch-icon.png') }}">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}?v=2">
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body{% block body_attrs %}{% endblock %}>
|
<body{% block body_attrs %}{% endblock %}>
|
||||||
|
|||||||
+11
-10
@@ -1851,23 +1851,24 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
(function() {
|
(function() {
|
||||||
const tabBtns = document.querySelectorAll('.settings-tab-btn');
|
const tabBtns = document.querySelectorAll('.settings-tab-btn');
|
||||||
const tabPanels = document.querySelectorAll('.settings-tab-panel');
|
const tabPanels = document.querySelectorAll('.settings-tab-panel');
|
||||||
|
const validTabs = ['overview', 'import', 'maintenance'];
|
||||||
|
|
||||||
function activateTab(tabName) {
|
function activateTab(tabName) {
|
||||||
tabBtns.forEach(btn => btn.classList.toggle('is-active', btn.dataset.tab === tabName));
|
tabBtns.forEach(function(btn) {
|
||||||
tabPanels.forEach(panel => panel.classList.toggle('is-active', panel.dataset.tab === tabName));
|
btn.classList.toggle('is-active', btn.dataset.tab === tabName);
|
||||||
history.replaceState({}, '', `#${tabName}`);
|
});
|
||||||
|
tabPanels.forEach(function(panel) {
|
||||||
|
panel.style.display = panel.dataset.tab === tabName ? 'block' : 'none';
|
||||||
|
});
|
||||||
|
history.replaceState(null, '', '#' + tabName);
|
||||||
}
|
}
|
||||||
|
|
||||||
tabBtns.forEach(btn => {
|
tabBtns.forEach(function(btn) {
|
||||||
btn.addEventListener('click', () => activateTab(btn.dataset.tab));
|
btn.addEventListener('click', function() { activateTab(btn.dataset.tab); });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Restore from URL hash on load
|
|
||||||
const hash = window.location.hash.replace('#', '');
|
const hash = window.location.hash.replace('#', '');
|
||||||
const validTabs = ['overview', 'import', 'maintenance'];
|
activateTab(validTabs.includes(hash) ? hash : 'overview');
|
||||||
if (validTabs.includes(hash)) {
|
|
||||||
activateTab(hash);
|
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user