Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Mouse Events #22

Open
cianfoley-nearform opened this issue Jan 24, 2019 · 5 comments
Open

Mouse Events #22

cianfoley-nearform opened this issue Jan 24, 2019 · 5 comments
Labels
invalid This doesn't seem right question Further information is requested

Comments

@cianfoley-nearform
Copy link
Collaborator

Investigate and integrate Mouse Events and some handy features e.g.

position already done, but should be part of mouse suite that can work together:

e.g.
click outside
double clicks vs single (timer based maybe configurable)
right click
pass in element or default to page (resize will need rework for this)
hover, again could be page vs element

all of these could be individual hooks, possibly could be justified to be in it's own lib

@jh3y
Copy link
Contributor

jh3y commented Jan 29, 2019

Worth thinking about how useful some of these would be or prioritising what would be useful. Many of the scenarios could be covered by the current set of synthetic events on offer. Creating a pass through function would over complicate things: https://reactjs.org/docs/events.html#supported-events

@jh3y jh3y added invalid This doesn't seem right question Further information is requested labels Jan 29, 2019
@cianfoley-nearform
Copy link
Collaborator Author

Sure, i think there's issue between determining single vs double click, again browserwide, the click outside should be a common enough use case too

@jh3y
Copy link
Contributor

jh3y commented Jan 30, 2019

There is an onDoubleClick in the docs.

Yeah. The off click could be a great one to implement. It's a tricky one I've written about before 👍

@cianfoley-nearform
Copy link
Collaborator Author

Yeah I know about doubleclick but AFAIK the single click is also set off by doubleclick (could be wrong here), we had a situation before where if doubleclick is clicked we don't want single click being triggered, it might be a usecase e.g. if doubleclick doesn't happen within X, raise singleclick events sort of thing and maybe apply to offclick if that was nailed too...

@jh3y
Copy link
Contributor

jh3y commented Jan 30, 2019

Nope that's completely correct 👍

The way I've tackled this previously is to store setInterval invocations in an Array in state and if doubleClick is fired, clear the intervals.

There's a rough example in this code: https://codepen.io/jh3y/pen/aPzVme

Could be a good gotcha one to implement a hook for 👍

  • Off click
  • Double + Single click handling

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants