webpack/components/RoutedTabs/index.js in katello-4.3.0.rc2.1 vs webpack/components/RoutedTabs/index.js in katello-4.3.0.rc3
- old
+ new
@@ -12,18 +12,20 @@
hash, key: locationKey,
} = useLocation();
// The below transforms #/history/6 to history
const currentTabFromUrl = head(last(hash.split('#/')).split('/'));
+ // Allows navigation back to mainTab
+ const onSubTab = currentTabFromUrl !== last(last(hash.split('#/')).split('/'));
const onSelect = (e, key) => {
e.preventDefault();
// See the below links for understanding of this mouseEvent
// https://www.w3schools.com/jsref/event_which.asp
// https://www.w3schools.com/jsref/event_button.asp
const middleMouseButtonNotUsed = !(e.button === 1 || e.buttons === 4 || e.which === 2);
const notCurrentTab = currentTabFromUrl !== key;
- if (middleMouseButtonNotUsed && notCurrentTab) {
+ if (middleMouseButtonNotUsed && (notCurrentTab || !!onSubTab)) {
push(`#/${key}`);
}
};
return (