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

[select] overrides native change event to CustomEvent globally #679

Open
MikeMatusz opened this issue Aug 29, 2024 · 0 comments
Open

[select] overrides native change event to CustomEvent globally #679

MikeMatusz opened this issue Aug 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@MikeMatusz
Copy link
Contributor

Describe the bug:
forge-select currently re-emits a change event as CustomEvent with a detail property of the selected value or values. It also changes the type in the global HTMLElementEventMap to match, which causes all change handlers on any element, including a native input or select, to be typed as CustomEvent instead of Event.

With strict TypeScript configurations, this causes incorrect types to be inferred in some scenarios, and also causes compilation errors when used in conjunction with certain libraries (such as CKEditor) whose type declarations make certain assumptions that are rendered invalid, e.g.:
image

To Reproduce:
Steps to reproduce the behavior:

  1. Inspect the inferred type of the change event in an addEventListener invocation in a TypeScript app.

Expected behavior:
The type declaration for change should be removed. The component could still re-emit the native change event if desirable, but should emit a forge-select-change event, which can be typed as CustomEvent.

Screenshots:
image

Please complete the following information:

  • Forge version: 2.0, 3.0
  • I have searched existing issues before creating this report? Y
  • Browser: All
  • Platform: All
  • OS: All

Additional context:

@MikeMatusz MikeMatusz added the bug Something isn't working label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant