@@ -181,12 +181,13 @@ const handleKeyDown = (event: KeyboardEvent) => {
181181}
182182
183183const handleUpKeyDown = () => {
184+ const clientKey = mqttTopicsStore .selectedConnection
184185 const selectedTopicIndex = allTopics .value .indexOf (mqttTopicsStore .selectedTopic )
185186 const previousTopic = topicToSelect (selectedTopicIndex , ' up' )
186187
187188 if (previousTopic ) {
188189 handleSelectTopic (mqttTopicsStore .selectedConnection , previousTopic )
189- handleScrollPreviousTopic (previousTopic )
190+ handleScrollPreviousTopic (clientKey , previousTopic )
190191 }
191192
192193 scrubbingTimeout .value = setTimeout (() => {
@@ -201,12 +202,13 @@ const handleUpKeyUp = () => {
201202}
202203
203204const handleDownKeyDown = () => {
205+ const clientKey = mqttTopicsStore .selectedConnection
204206 const selectedTopicIndex = allTopics .value .indexOf (mqttTopicsStore .selectedTopic )
205207 const nextTopic = topicToSelect (selectedTopicIndex , ' down' )
206208
207209 if (nextTopic ) {
208210 handleSelectTopic (mqttTopicsStore .selectedConnection , nextTopic )
209- handleScrollNextTopic (nextTopic )
211+ handleScrollNextTopic (clientKey , nextTopic )
210212 }
211213
212214 scrubbingTimeout .value = setTimeout (() => {
@@ -233,7 +235,7 @@ const handleLeftKey = () => {
233235
234236 if (previousTopic ) {
235237 handleSelectTopic (clientKey , previousTopic )
236- handleScrollPreviousTopic (previousTopic )
238+ handleScrollPreviousTopic (clientKey , previousTopic )
237239 }
238240 }
239241}
@@ -251,14 +253,14 @@ const handleRightKey = () => {
251253
252254 if (nextTopic ) {
253255 handleSelectTopic (clientKey , nextTopic )
254- handleScrollNextTopic (nextTopic )
256+ handleScrollNextTopic (clientKey , nextTopic )
255257 }
256258 }
257259}
258260
259- const handleScrollPreviousTopic = (previousTopic : string ) => {
261+ const handleScrollPreviousTopic = (clientKey : string , previousTopic : string ) => {
260262 const virtualScroll = document .getElementById (' topicsVirtualScroll' )
261- const element = document .getElementById (` topic-item-${previousTopic }-intersection ` )
263+ const element = document .getElementById (` topic-item-${clientKey }:${ previousTopic }-intersection ` )
262264
263265 if (virtualScroll && element ) {
264266 if (element .offsetTop < virtualScroll .scrollTop ) {
@@ -272,9 +274,9 @@ const handleScrollPreviousTopic = (previousTopic: string) => {
272274 }
273275}
274276
275- const handleScrollNextTopic = (nextTopic : string ) => {
277+ const handleScrollNextTopic = (clientKey : string , nextTopic : string ) => {
276278 const virtualScroll = document .getElementById (' topicsVirtualScroll' )
277- const element = document .getElementById (` topic-item-${nextTopic }-intersection ` )
279+ const element = document .getElementById (` topic-item-${clientKey }:${ nextTopic }-intersection ` )
278280
279281 if (virtualScroll && element ) {
280282 if (
0 commit comments