Skip to content

Commit

Permalink
fix: Perceptor tab is not selected after refreshing (#864)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyantong2000 authored Aug 21, 2024
1 parent 3c189d5 commit fe2f314
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pages/ContentScripts/features/perceptor-tab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const addPerceptorTab = async (): Promise<void | false> => {
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');

Expand Down Expand Up @@ -75,6 +78,13 @@ const updatePerceptorTabHighlighting = async (): Promise<void> => {
// 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');
Expand Down

0 comments on commit fe2f314

Please sign in to comment.