Browse Source

Use a much more specific selector using child selectors.

Ian Rose 5 năm trước cách đây
mục cha
commit
3c5fa31270
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      packages/application-extension/src/index.tsx

+ 5 - 2
packages/application-extension/src/index.tsx

@@ -534,8 +534,11 @@ function addCommands(app: JupyterLab, palette: ICommandPalette): void {
   });
   palette.addItem({ command: CommandIDs.activatePreviousTab, category });
 
-  // A CSS selector targeting tabs in the main area.
-  const tabSelector = '.p-DockPanel .p-TabBar-tab';
+  // A CSS selector targeting tabs in the main area. This is a very
+  // specific selector since we really only want tabs that are
+  // in the main area, as opposed to those in sidebars, ipywidgets, etc.
+  const tabSelector =
+    '#jp-main-dock-panel > .p-TabBar > .p-TabBar-content > .p-TabBar-tab';
 
   commands.addCommand(CommandIDs.close, {
     label: () => 'Close Tab',