Skip to content

Problem with camelCased event names on WebComponents (CustomElements) #6077

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

Closed
nosfair-fma opened this issue Jun 8, 2022 · 2 comments
Closed

Comments

@nosfair-fma
Copy link

Vue version

3.2.37

Link to minimal reproduction

https://github.com/nosfair-fma/nuxt3-stencil-interop

Steps to reproduce

  • run "yarn bootstrap && yarn dev"
  • open "http://localhost:3000"
  • preferably, open dev-tools
  • click the button that says "click to raise events"

What is expected?

  • an event for the "lowercaseevent" should be raised and logged to the console through the "@event" bound handler
  • an event for the "camelCaseEvent" should be raised and logged to the console through the "@event" bound handler
  • an event for the "camelCaseEvent" should be raised and logged to the console through the native "Element.addEventListener" bound handler

What is actually happening?

  • the lowercase event works
  • the camelCase event does not work with the "@event" syntax
  • the camelCase event does get logged for the "native eventListener" (to prove that it is raised and generally working, but also to show the details of the CustomEvent that is emitted)

since i was not able to find any information about naming restrictions (quite the opposite, camelCase event names seem to be standard, widely used and even advertised on the respective vue documentation), i consider this a bug

System Info

System:
    OS: Linux 5.13 elementary OS 6.1 Jólnir
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 23.09 GB / 31.16 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash

Any additional comments?

  • the web component in qustion is built with StencilJS, it's functionality is confirmed to work outside of VueJs scopes
  • i am using nuxt, but i am pretty certain that this is vue-related since the event binding is a documented vue feature - if not, i am sorry
  • all necessary code is to be found in nuxt-app/app.vue
@lidlanca
Copy link
Contributor

check if this may be related
#5401

if it is, there are work arounds suggested in comments.

@nosfair-fma
Copy link
Author

yes, the workaround with the custom directive seems to work fine - thank you! :)

@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants