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

Modus Icon: Event Name is iconClick, not onClick as shown in Storybook and clicking causes error #2058

Closed
2 tasks done
cjwinsor opened this issue Jan 24, 2024 · 1 comment
Closed
2 tasks done
Assignees
Labels
bug Something is wrong and needs to be addressed external-request Bugs and features reported by individuals from other teams in Trimble priority:medium Prioritization for this item is medium

Comments

@cjwinsor
Copy link
Contributor

Prerequisites

Describe the issue

Component creates iconClick event

  @Event() iconClick?: EventEmitter;

But Storybook shows it has having an onClick event that is emitted
image

And when the icon is clicked it produces an error

Uncaught TypeError: Cannot read properties of undefined (reading 'emit')
    at Object.onClick (25.cf0f1bcf.iframe.bundle.js:1:2565)
    at IconSun.Object.onClick (0.fb127b46.iframe.bundle.js:1:421530)

This is caused by the icons onClick being set as

<IconMap ... onClick={this.onClick} ... />

when it should be this at minimum to maintain the this context.

<IconMap ... onClick={() => this.onClick()} ... />

Otherwise the context will be the icon from the icon map, not the modus-icon.

I am creating this ticket so I can work on it later.

Reduced test cases

In Storybook for MWC, navigate to the Icon component and click on the icon. Observer the javascript error in the dev console.

What operating system(s) are you seeing the problem on?

No response

What browser(s) are you seeing the problem on?

No response

What is the issue regarding ?

@trimble-oss/modus-web-components

What version of npm package are you using ?

v0.13.0

Priority

Medium

What product/project are you using Modus Components for ?

Modus

What is your team/division name ?

Modus

Are you willing to contribute ?

Maybe

Are you using Modus Web Components in production ?

No response

@cjwinsor cjwinsor added the bug Something is wrong and needs to be addressed label Jan 24, 2024
@github-actions github-actions bot added the external-request Bugs and features reported by individuals from other teams in Trimble label Jan 24, 2024
@enowak1031 enowak1031 moved this from In Review to To Do in Modus Web Components Nov 6, 2024
@enowak1031 enowak1031 added the priority:medium Prioritization for this item is medium label Nov 6, 2024
@ElishaSamPeterPrabhu
Copy link
Collaborator

Closing this issue as it is fixed in #2201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong and needs to be addressed external-request Bugs and features reported by individuals from other teams in Trimble priority:medium Prioritization for this item is medium
Projects
Status: Done
Development

No branches or pull requests

3 participants