fix(ui): scroll to top when switching device sidebar tabs
Wraps setActiveTab to also scroll #main-content to top. Prevents stale scroll position when navigating from a long tab (e.g. Firewall) to a short one (e.g. SNMP). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -302,7 +302,11 @@ function DeviceDetailPage() {
|
|||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const { user } = useAuth()
|
const { user } = useAuth()
|
||||||
const [showCreds, setShowCreds] = useState(false)
|
const [showCreds, setShowCreds] = useState(false)
|
||||||
const [activeTab, setActiveTab] = useState('overview')
|
const [activeTab, setActiveTabRaw] = useState('overview')
|
||||||
|
const setActiveTab = (tab: string) => {
|
||||||
|
setActiveTabRaw(tab)
|
||||||
|
document.getElementById('main-content')?.scrollTo(0, 0)
|
||||||
|
}
|
||||||
const [editOpen, setEditOpen] = useState(false)
|
const [editOpen, setEditOpen] = useState(false)
|
||||||
const { mode, toggleMode } = useSimpleConfigMode(deviceId)
|
const { mode, toggleMode } = useSimpleConfigMode(deviceId)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user