File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1133,15 +1133,28 @@ function App({
11331133 inspectorStderrLogs ,
11341134 ] ) ;
11351135
1136- // Set focus to the default for the active tab whenever the tab changes
1136+ // Keep focus state consistent when switching tabs (only adjust if focus is already in tab content)
11371137 useEffect ( ( ) => {
11381138 if ( activeTab === "messages" ) {
1139- setFocus ( "messagesList" ) ;
1139+ if ( focus === "tabContentList" || focus === "tabContentDetails" ) {
1140+ setFocus ( "messagesList" ) ;
1141+ }
11401142 } else if ( activeTab === "requests" ) {
1141- setFocus ( "requestsList" ) ;
1143+ if ( focus === "tabContentList" || focus === "tabContentDetails" ) {
1144+ setFocus ( "requestsList" ) ;
1145+ }
11421146 } else {
1143- setFocus ( "tabContentList" ) ;
1147+ if (
1148+ focus === "messagesList" ||
1149+ focus === "messagesDetail" ||
1150+ focus === "requestsList" ||
1151+ focus === "requestsDetail"
1152+ ) {
1153+ setFocus ( "tabContentList" ) ;
1154+ }
11441155 }
1156+ // Intentionally not depending on focus to avoid loops
1157+ // eslint-disable-next-line react-hooks/exhaustive-deps
11451158 } , [ activeTab ] ) ;
11461159
11471160 // Switch away from logging tab if server is not stdio
You can’t perform that action at this time.
0 commit comments