From fe2f314cae2e8c050f4795101dc7a29cb4c392f7 Mon Sep 17 00:00:00 2001 From: wangyantong <135088663+wangyantong2000@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:11:00 +0800 Subject: [PATCH] fix: Perceptor tab is not selected after refreshing (#864) --- .../ContentScripts/features/perceptor-tab/index.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pages/ContentScripts/features/perceptor-tab/index.tsx b/src/pages/ContentScripts/features/perceptor-tab/index.tsx index 8fe7b61f..667c218c 100644 --- a/src/pages/ContentScripts/features/perceptor-tab/index.tsx +++ b/src/pages/ContentScripts/features/perceptor-tab/index.tsx @@ -24,7 +24,10 @@ const addPerceptorTab = async (): Promise => { perceptorTab.href = perceptorHref; perceptorTab.id = featureId; perceptorTab.setAttribute('data-tab-item', featureId); - + perceptorTab.setAttribute( + 'data-analytics-event', + `{"category":"Underline navbar","action":"Click tab","label":"Perceptor","target":"UNDERLINE_NAV.TAB"}` + ); const perceptorTitle = $('[data-content]', perceptorTab); perceptorTitle.text('Perceptor').attr('data-content', 'Perceptor'); @@ -75,6 +78,13 @@ const updatePerceptorTabHighlighting = async (): Promise => { // no operation needed if (!isPerceptor()) return; // if perceptor tab + if (insightsTab.hasClass('selected')) { + insightsTab.removeClass('selected'); + insightsTab.removeAttr('aria-current'); + perceptorTab.attr('aria-current', 'page'); + perceptorTab.addClass('selected'); + } + const insightsTabSeletedLinks = insightsTab.attr('data-selected-links'); insightsTab.removeAttr('data-selected-links'); perceptorTab.attr('data-selected-links', 'pulse');