diff --git a/src/popup/bookmark-button/components/BookmarkButton.tsx b/src/popup/bookmark-button/components/BookmarkButton.tsx index bdb4340cbe..a4f8066656 100644 --- a/src/popup/bookmark-button/components/BookmarkButton.tsx +++ b/src/popup/bookmark-button/components/BookmarkButton.tsx @@ -30,9 +30,8 @@ interface StateProps { } interface DispatchProps { - toggleBookmark: ClickHandler + toggleBookmark: (element: HTMLElement) => void } - export type Props = OwnProps & StateProps & DispatchProps class BookmarkButton extends PureComponent { @@ -67,7 +66,11 @@ class BookmarkButton extends PureComponent { return ( !isPageSaved && this.props.toggleBookmark} + onClick={(event) => { + if (!isPageSaved) { + this.props.toggleBookmark(event.currentTarget) + } + }} disabled={this.props.isDisabled || isPageSaved} > DispatchProps = ( dispatch, props, ) => ({ - toggleBookmark: async (e) => { - { - const allowed = await pageActionAllowed(analyticsBG) - - if (allowed) { - e.preventDefault() + toggleBookmark: async (element: HTMLElement) => { + const allowed = await pageActionAllowed(analyticsBG) - await dispatch(acts.toggleBookmark()) - } + if (allowed) { + await dispatch(acts.toggleBookmark()) } }, }) diff --git a/src/popup/collections-button/components/CollectionsButton.tsx b/src/popup/collections-button/components/CollectionsButton.tsx index 97094798f1..58a0b7becb 100644 --- a/src/popup/collections-button/components/CollectionsButton.tsx +++ b/src/popup/collections-button/components/CollectionsButton.tsx @@ -20,8 +20,8 @@ interface StateProps { } interface DispatchProps { - toggleCollectionsPopup: ClickHandler - toggleAllTabsPopup: ClickHandler + toggleCollectionsPopup: ClickHandler + toggleAllTabsPopup: ClickHandler } export type Props = OwnProps & StateProps & DispatchProps @@ -55,9 +55,11 @@ class CollectionsButton extends PureComponent { render() { return ( - !this.props.isDisabled && this.props.toggleCollectionsPopup - } + onClick={(event) => { + if (!this.props.isDisabled) { + this.props.toggleCollectionsPopup(event) + } + }} disabled={this.props.isDisabled} >