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.ico') }}" sizes="any">
|
||||
<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 %}
|
||||
</head>
|
||||
<body{% block body_attrs %}{% endblock %}>
|
||||
|
||||
+11
-10
@@ -1851,23 +1851,24 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
(function() {
|
||||
const tabBtns = document.querySelectorAll('.settings-tab-btn');
|
||||
const tabPanels = document.querySelectorAll('.settings-tab-panel');
|
||||
const validTabs = ['overview', 'import', 'maintenance'];
|
||||
|
||||
function activateTab(tabName) {
|
||||
tabBtns.forEach(btn => btn.classList.toggle('is-active', btn.dataset.tab === tabName));
|
||||
tabPanels.forEach(panel => panel.classList.toggle('is-active', panel.dataset.tab === tabName));
|
||||
history.replaceState({}, '', `#${tabName}`);
|
||||
tabBtns.forEach(function(btn) {
|
||||
btn.classList.toggle('is-active', btn.dataset.tab === tabName);
|
||||
});
|
||||
tabPanels.forEach(function(panel) {
|
||||
panel.style.display = panel.dataset.tab === tabName ? 'block' : 'none';
|
||||
});
|
||||
history.replaceState(null, '', '#' + tabName);
|
||||
}
|
||||
|
||||
tabBtns.forEach(btn => {
|
||||
btn.addEventListener('click', () => activateTab(btn.dataset.tab));
|
||||
tabBtns.forEach(function(btn) {
|
||||
btn.addEventListener('click', function() { activateTab(btn.dataset.tab); });
|
||||
});
|
||||
|
||||
// Restore from URL hash on load
|
||||
const hash = window.location.hash.replace('#', '');
|
||||
const validTabs = ['overview', 'import', 'maintenance'];
|
||||
if (validTabs.includes(hash)) {
|
||||
activateTab(hash);
|
||||
}
|
||||
activateTab(validTabs.includes(hash) ? hash : 'overview');
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user