Fix shift issue when clicking on empty sidebar on the news page (fixes #242)
Change-Id: I4f959c184bda1327aca904f5c7fa8e5780814df9
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index e98512c..ebe9df9 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -326,7 +326,7 @@
const results = document.querySelector('.found');
const aside = document.querySelector('aside');
- if (aside && aside.classList.contains('active') && !isSmallScreen) {
+ if (aside && aside.classList.contains('active') && !aside.classList.contains('off') && !isSmallScreen) {
header.classList.add('shifted');
if (!results) {
main.classList.add('shifted');
@@ -368,7 +368,7 @@
document.body.removeChild(span);
let hintLeftPosition = inputWidth;
- if (aside && aside.classList.contains('active') && !isSmallScreen) {
+ if (aside && aside.classList.contains('active') && !aside.classList.contains('off') && !isSmallScreen) {
const asideWidth = aside.getBoundingClientRect().width;
hintLeftPosition += asideWidth;
}
@@ -412,8 +412,10 @@
// Make aside active on focus
aside.addEventListener('focus', function (e) {
- this.classList.add('active');
- shiftContent();
+ if (!this.classList.contains('off')) {
+ this.classList.add('active');
+ shiftContent();
+ }
});
// Deactivate focus when clicking anywhere else