From c186d3d3a4699f0d4df203be245dcfdb47e048dd Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Mon, 16 Jan 2023 14:57:05 +0800 Subject: [PATCH] ! Fix searching (2nd time onward) in channel view broken --- src/renderer/views/Channel/Channel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index ecc5ed23cc75a..a1691208e81f9 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -676,12 +676,13 @@ export default Vue.extend({ } } + // `currentTabNode` can be `null` on 2nd+ search const currentTabNode = document.querySelector('.tabs > .tab[aria-selected="true"]') // `newTabNode` can be `null` when `tab` === "search" const newTabNode = document.getElementById(`${tab}Tab`) - document.querySelector('.tabs > .tab[tabindex="0"]').setAttribute('tabindex', '-1') + document.querySelector('.tabs > .tab[tabindex="0"]')?.setAttribute('tabindex', '-1') newTabNode?.setAttribute('tabindex', '0') - currentTabNode.setAttribute('aria-selected', 'false') + currentTabNode?.setAttribute('aria-selected', 'false') newTabNode?.setAttribute('aria-selected', 'true') this.currentTab = tab newTabNode?.focus({ focusVisible: true })