From 7a8733425e37a0c088b51c1f0f242919b3e9a706 Mon Sep 17 00:00:00 2001 From: Pete Miller Date: Tue, 10 Oct 2017 23:35:57 -0700 Subject: [PATCH] Fix bug affecting width of tabs when closing them with the mouse. Fix #11434 The tabs are meant to stay the same size until mouseout, according to #6088 and implemented in #6342. They were sometimes growing (or shrinking) on click and then shrinking further on mouseout due to the size being calculated at the wrong time --- .../components/tabs/content/closeTabIcon.js | 21 ++----------------- app/renderer/components/tabs/tab.js | 3 ++- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/app/renderer/components/tabs/content/closeTabIcon.js b/app/renderer/components/tabs/content/closeTabIcon.js index 42607a30f38..905c7b6535d 100644 --- a/app/renderer/components/tabs/content/closeTabIcon.js +++ b/app/renderer/components/tabs/content/closeTabIcon.js @@ -15,10 +15,6 @@ const tabUIState = require('../../../../common/state/tabUIState') const closeState = require('../../../../common/state/tabContentState/closeState') const frameStateUtil = require('../../../../../js/state/frameStateUtil') -// Actions -const windowActions = require('../../../../../js/actions/windowActions') -const appActions = require('../../../../../js/actions/appActions') - // Styles const {theme} = require('../../styles/theme') const {spacing, zindex} = require('../../styles/global') @@ -28,20 +24,9 @@ const closeTabSvg = require('../../../../extensions/brave/img/tabs/close_btn.svg class CloseTabIcon extends React.Component { constructor (props) { super(props) - this.onClick = this.onClick.bind(this) this.onDragStart = this.onDragStart.bind(this) } - onClick (event) { - event.stopPropagation() - if (this.props.hasFrame) { - windowActions.onTabClosedWithMouse({ - fixTabWidth: this.props.fixTabWidth - }) - appActions.tabCloseRequested(this.props.tabId) - } - } - onDragStart (event) { event.preventDefault() } @@ -54,12 +39,10 @@ class CloseTabIcon extends React.Component { const props = {} props.isPinned = isPinned - props.fixTabWidth = ownProps.fixTabWidth + props.onClick = ownProps.onClick props.hasFrame = frameStateUtil.hasFrame(currentWindow, frameKey) props.centralizeTabIcons = tabUIState.centralizeTabIcons(currentWindow, frameKey, isPinned) props.showCloseIcon = closeState.showCloseTabIcon(currentWindow, frameKey) - props.tabId = tabId - return props } @@ -76,7 +59,7 @@ class CloseTabIcon extends React.Component { this.props.centralizeTabIcons && styles.closeTab__icon_centered )} l10nId='closeTabButton' - onClick={this.onClick} + onClick={this.props.onClick} onDragStart={this.onDragStart} draggable='true' /> diff --git a/app/renderer/components/tabs/tab.js b/app/renderer/components/tabs/tab.js index 034b3cc8853..c38d73858a6 100644 --- a/app/renderer/components/tabs/tab.js +++ b/app/renderer/components/tabs/tab.js @@ -61,6 +61,7 @@ class Tab extends React.Component { this.onDragOver = this.onDragOver.bind(this) this.onClickTab = this.onClickTab.bind(this) this.onObserve = this.onObserve.bind(this) + this.onTabClosedWithMouse = this.onTabClosedWithMouse.bind(this) this.tabNode = null } @@ -356,7 +357,7 @@ class Tab extends React.Component { - + }