web component events are discarded when their name is not lowercase
pbuszka opened this issue · comments
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
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.