Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Fix(Popup): Trigger's props are not passed in onClick handler #521

Merged
merged 4 commits into from
Nov 23, 2018

Conversation

sophieH29
Copy link
Contributor

This PR addresses fix for a small issued encountered in Popup

Let's say we have a Popup, with Button component as a trigger

 <Popup
        // you expect on Button's click receive 2 arguments, but recieve only event object
       // props are undefined
        trigger={<Button onClick={(e, props) =>  {}} />}
        content={{ content: <Some content> }}
      />

For Button's onClick you expect to receive 2 arguments, event and props, but in fact, receive only event object as popup's handler cut off this from click event pipeline.

Even bigger issue with that can be found, when use Popup as MenuItem

  <Menu>
     <Menu.Item>
     <Menu.Item>
     <Popup><Menu.Item></Popup>
  </Menu>

When click on MenuItem, event firstly propagates to Popup which cut off essential props, then Menu handles that event and can't find props as arguments.

Copy link
Contributor

@kuzhelov kuzhelov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 please, just update CHANGELOG before merging

@codecov
Copy link

codecov bot commented Nov 23, 2018

Codecov Report

Merging #521 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #521   +/-   ##
======================================
  Coverage    88.3%   88.3%           
======================================
  Files          42      42           
  Lines        1454    1454           
  Branches      186     186           
======================================
  Hits         1284    1284           
  Misses        165     165           
  Partials        5       5
Impacted Files Coverage Δ
src/components/Popup/Popup.tsx 30.09% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 850b5de...2229a58. Read the comment docs.

@sophieH29 sophieH29 merged commit 14ea899 into master Nov 23, 2018
@sophieH29 sophieH29 deleted the fix/popup-pass-props-on-click branch November 23, 2018 12:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants