Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ClickAwayListener] Dependency on EventListener? #15126

Closed
2 tasks done
cmparsons opened this issue Mar 30, 2019 · 4 comments · Fixed by #15420
Closed
2 tasks done

[ClickAwayListener] Dependency on EventListener? #15126

cmparsons opened this issue Mar 30, 2019 · 4 comments · Fixed by #15420
Milestone

Comments

@cmparsons
Copy link

The docs for ClickAwayListener mention that the props for EventListener are available, but the TypeScript types are not exposing EventListenerProps.

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

Should be able to add props for EventListener to ClickAwayListener without TS errors.

Current Behavior 😯

TS errors when trying to add props like target

Steps to Reproduce 🕹

Link: https://codesandbox.io/s/vm4p17y5ol

Context 🔦

Your Environment 🌎

Tech Version
Material-UI latest
React
Browser
TypeScript
etc.
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 30, 2019

@cmparsons We will remove EventListener in the next versions. What's your use case?

@oliviertassinari oliviertassinari modified the milestones: v4, v4.1 Mar 30, 2019
@oliviertassinari oliviertassinari added deprecation New deprecation message and removed breaking change labels Mar 30, 2019
@cmparsons
Copy link
Author

Hi @oliviertassinari . My use case was to trigger the onClickAway callback for clicks within a certain DOM node and prevent triggers for clicks on other areas of the page. I wanted to pass the actual DOM node as a target to the EventListener. There may be better solutions to what I'm trying to do (I haven't done much researching honestly), but I was hoping to use ClickAwayListener and EventListener since I was already using material ui in my project.

@eps1lon
Copy link
Member

eps1lon commented Mar 31, 2019

Well right now it's still documented so we should add types for it (or rather accept PRs adding them).

But it's very low priority since we will deprecate it soon. If anybody wants to make contributions that concern TypeScript they can take a look at https://github.com/mui-org/material-ui/issues?utf8=%E2%9C%93&q=is%3Aopen+label%3Atypescript+is%3Aissue

@oliviertassinari oliviertassinari changed the title [TypeScript]: ClickAwayListener does not expose props for EventListener [ClickAwayListener] Dependency on EventListener? Apr 15, 2019
@oliviertassinari oliviertassinari added breaking change and removed deprecation New deprecation message labels Apr 17, 2019
@oliviertassinari oliviertassinari modified the milestones: v4.1, v4 Apr 17, 2019
@oliviertassinari
Copy link
Member

@cmparsons As a workaround, does it work wrapping the DOM node you are directly interested into?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants