g-loot / react-tournament-brackets

React component library for displaying bracket leaderboards
https://sleepy-kare-d8538d.netlify.app/?path=/story/components-bracket--bracket
GNU Lesser General Public License v2.1
219 stars 69 forks source link

Feature: Pass mouse event back when calling `onMatchClick` prop #31

Closed ted537 closed 2 years ago

ted537 commented 2 years ago

If we want to provide alternate behaviour (such as opening match details possibly in a new tab), then we need access to the underlying mouse event.

Right now, this information is lost and we would have to either a) track whether CTRL is pressed ourselves (on the side) or b) Hunt down a ref to the DOM node with the "Match Details" text.

Tracking keypresses on the side would probably get even weirder for something like middle-mouse click where there is no indicator ahead-of-time

Thanks!

https://github.com/g-loot/react-tournament-brackets/blob/a430d5f05d1a33ab9a7aa1cc6808e5593dcebabb/src/components/match/index.tsx#L34-L38

ted537 commented 2 years ago

Upon further thought, since this is already an anchor (<a>) element, passing in the href and target props should be sufficient.