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

Password: Incorrect onClick property as scope for custom icons #3900

Closed
service-paradis opened this issue Apr 24, 2023 · 0 comments
Closed
Assignees
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@service-paradis
Copy link

Describe the bug

You added support for custom icons in Primevue 3.27.0 which is really appreciated!

There is a bug using custom icons for the Password component. The onClick function sent as scope property is defined like this:

:onClick="() => onMaskToggle"

But it should be defined like this:

:onClick="onMaskToggle"

Right now, we have to call the function twice to make this work. Ex.

<template #showicon="{ onClick }">
  <FontAwesomeIcon :icon="['far', 'eye']" @click="onClick()()" />
</template>

Reproducer

https://codesandbox.io/s/billowing-worker-187lxo

PrimeVue version

3.27.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

Version 1.50.114 Chromium: 112.0.5615.49 (Build officiel) (64 bits)

Steps to reproduce the behavior

  1. Customize the icons for the Password component. Ex.
  <Password>
    <template #showicon="{ onClick }">
      <FontAwesomeIcon :icon="['far', 'eye']" @click="onClick()()" />
    </template>
    <template #hideicon="{ onClick }">
      <FontAwesomeIcon :icon="['far', 'eye-slash']" @click="onClick()()" />
    </template>
  </Password>
  1. Take a look at how we need to call the received onClick event

Expected behavior

The onClick event sent as scope should be define as :onClick="onMaskToggle" in lib/password/Password.vue instead of :onClick="() => onMaskToggle". Right now, to make it works, we need to call it twice like @click="onClick()()" which is not desirable.

@service-paradis service-paradis added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 24, 2023
@tugcekucukoglu tugcekucukoglu added this to the 3.28.0 milestone Apr 25, 2023
@tugcekucukoglu tugcekucukoglu added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Apr 25, 2023
@tugcekucukoglu tugcekucukoglu self-assigned this Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants