airblade / stimulus-datepicker

Stimulus-powered accessible datepicker
https://airblade.github.io/stimulus-datepicker/
MIT License
66 stars 5 forks source link

Not possible to subclass #24

Open airblade opened 1 year ago

airblade commented 1 year ago

The controller adds some actions itself to avoid the user having to add them in their markup.

However these have the name of the controller hardcoded. For example:

https://github.com/airblade/stimulus-datepicker/blob/0c4defd2b9a7c9a637a8bdecaccdb9ac9d4e6e83/src/datepicker.js#L92

This means a child controller won't work properly.

Yasser commented 1 year ago

Probably makes sense to add the action via an EventListener rather than markup?

airblade commented 1 year ago

Yes, I agree.

I quite liked just being able to set an attribute to add an event listener ;)

Yasser commented 1 year ago

Still could, just use click->${this.identifier}#toggle