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

[EuiOutsideClickDetector] Accept standard event types #4422

Closed
nickofthyme opened this issue Jan 12, 2021 · 5 comments · Fixed by #4434
Closed

[EuiOutsideClickDetector] Accept standard event types #4422

nickofthyme opened this issue Jan 12, 2021 · 5 comments · Fixed by #4434

Comments

@nickofthyme
Copy link
Contributor

nickofthyme commented Jan 12, 2021

Some eui component events like EuiOutsideClickDetector.onOutsideClick, use the EuiEvent but this type is not exported from @elastic/eui/src/components/outside_click_detector/outside_click_detector.

onOutsideClick: (event: EuiEvent) => void;

Please add this to the top level exports. Thanks.

@chandlerprall
Copy link
Contributor

EuiEvent is essentially internal to EuiOutsideClickDetector, is not having access to it creating an issue in TS with passing an event handler?

@nickofthyme
Copy link
Contributor Author

nickofthyme commented Jan 12, 2021

It's not essential but I am just declaring the callback function elsewhere which needs the type. See elastic/kibana@587153d.

I am fine leaving it that way but I just wanted to mention it. I also thought it was more widely used than just in EuiOutsideClickDetector.

@chandlerprall
Copy link
Contributor

I think we should define those props better, instead, to allow normally-typed event handlers to be passed through. There's some differences between mouse and touch events EUI would need to handle, but I feel that's better (and more accurate anyway) than having consumers rely on the EuiEvent type.

Any thoughts on this @thompsongl ?

@thompsongl
Copy link
Contributor

I agree with your assessment that we should allow passing standard event types and have EuiOutsideClickDetector handle internally any type adjustments.

@nickofthyme
Copy link
Contributor Author

Sounds good to me. Feel free to close or reword this issue.

@thompsongl thompsongl self-assigned this Jan 20, 2021
@thompsongl thompsongl changed the title Export EuiEvent at top level [EuiOutsideClickDetector] Accept standard event types Jan 20, 2021
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