From 7dc09faa9bede19912609bad8154874aa052dd46 Mon Sep 17 00:00:00 2001 From: therealrinku Date: Thu, 19 Oct 2023 09:39:23 +0545 Subject: [PATCH] feat: scroll to the active tab on click --- .../Collections/Collection/CollectionItem/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js index db5bfc02c..31186e380 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js @@ -87,7 +87,17 @@ const CollectionItem = ({ item, collection, searchText }) => { 'item-focused-in-tab': item.uid == activeTabUid }); + const scrollToTheActiveTab = () => { + const activeTab = document.querySelector('.request-tab.active'); + if (activeTab) { + activeTab.scrollIntoView({ behavior: 'smooth', block: 'start' }); + } + }; + const handleClick = (event) => { + //scroll to the active tab + setTimeout(scrollToTheActiveTab, 50); + if (isItemARequest(item)) { dispatch(hideHomePage()); if (itemIsOpenedInTabs(item, tabs)) {