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

web component events are discarded when their name is not lowercase #77

Closed
pbuszka opened this issue Jan 13, 2021 · 1 comment
Closed
Labels

Comments

@pbuszka
Copy link

pbuszka commented Jan 13, 2021

For web compnents that have events that are not lowercase EventProp does not work correctly and events are not detected.
new EventProp[dom.Event]("MDCSnackbar:closed") works like new EventProp[dom.Event]("mdcsnackbar:closed")

example web component using non-lowercase events https://github.com/material-components/material-components-web/tree/master/packages/mdc-snackbar

I traced the problem to com.raquo.laminar.DomApi#addEventListener which uses domName in

class EventProp[Ev](override val name: String) extends Key {
  @inline def domName: String = name.toLowerCase
} 

and registers event listener with lower case and events are not detected.

I am not sure if there is a some other reason for toLowerCase but definitely it breaks things in the above mentioned situation

@raquo
Copy link
Owner

raquo commented Jan 14, 2021

Good find, thanks. Turns out non-WebComponent event names shouldn't be lowercased either, the browsers are just more lenient there (EDIT: they aren't, our event name strings in SDT are just already lowercased). Easy fix, I'll add this to 0.12.0-m1, coming this weekend I hope.

@raquo raquo added the bug label Jan 14, 2021
yurique pushed a commit to yurique/Laminar that referenced this issue Jan 18, 2021
@raquo raquo closed this as completed in f9f1262 Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants