debugger icon indicating copy to clipboard operation
debugger copied to clipboard

The dropdown button does not display by resizing center pane

Open magicp-github opened this issue 10 years ago • 1 comments

Steps to Reproduce:

  1. Start Nightly
  2. Go to any sites (e.g. about:home)
  3. Open DevTools > Debugger (Ctrl+Shift+S)
  4. Open more than two sources, but source tab is not overflowed
  5. Narrow center pane until source tab is overflowed

Actual Results: The dropdown button does not display by resizing center pane.

Expected Results:

  • The dropdown button is displayed if source tab is overflowed by resizing center pane.
  • The dropdown button is hidden if source tab is not overflowed by resizing center pane.

magicp-github avatar Nov 19 '16 00:11 magicp-github

Here's a patch that should be close to what we need to do.

diff --git a/src/components/SourceTabs.js b/src/components/SourceTabs.js
index 20a7e8e..82721ac 100644
--- a/src/components/SourceTabs.js
+++ b/src/components/SourceTabs.js
@@ -61,7 +61,16 @@ const SourceTabs = React.createClass({
   },

   componentDidUpdate() {
-    this.updateHiddenSourceTabs(this.props.sourceTabs);
+    this.updateHiddenSourceTabs();
+  },
+
+  componentDidMount() {
+    this.updateHiddenSourceTabs();
+    window.addEventListener("resize", this.updateHiddenSourceTabs, false);
+  },
+
+  componentDidDismount() {
+    window.removeEventListener("resize", this.updateHiddenSourceTabs);
   },

   onTabContextMenu(event, tab) {
@@ -127,7 +136,8 @@ const SourceTabs = React.createClass({
    * Updates the hiddenSourceTabs state, by
    * finding the source tabs who have wrapped and are not on the top row.
    */
-  updateHiddenSourceTabs(sourceTabs) {
+  updateHiddenSourceTabs() {
+    const sourceTabs = this.props.sourceTabs;
     if (!this.refs.sourceTabs) {
       return;
     }

jasonLaster avatar Nov 28 '16 13:11 jasonLaster