vigetlabs / ca11y

A lightweight accessible dependency-free datepicker
http://code.viget.com/ca11y
26 stars 6 forks source link

Expose more Lifecycle Hooks #19

Open solomonhawk opened 8 years ago

solomonhawk commented 8 years ago

Related to #13

If this package goes the route of #13 and the DOM glue is left as an external concern then we don't need to worry about proxying handlers for things like onBlur, onFocus, etc. because that can be left to user-land code.

Purpose:

Allow users to tie their code into more of the internal events that Ca11y uses.

Could include some of the following events: onPrevMonth() onNextMonth() onDaySelected() onClose() onOpen()

I think these callbacks should all be configured under options.

greypants commented 8 years ago

Can you give me some examples of what you'd do with these hooks (aside from what they're doing by default)?

averyvery commented 8 years ago

I think onDaySelected is the one I would immediately be interested in, because in same cases, once the day is selected, I would want to update part of the UI, re-validate a form, or submit an AJAX response.

This isn't possible with the current state of ca11y, since I can't listen for changes to the input value that are triggered by the library.

averyvery commented 8 years ago

Confirmed; I'm trying to use ca11y on a react project that submits data onBlur, but the onBlur never triggers with ca11y. I will start a branch that adds onDaySelected(), but I won't PR/merge it; I'll just install ca11y from that branch since I need this asap.

averyvery commented 8 years ago

This is dirty, but, just for future reference: https://github.com/vigetlabs/ca11y/compare/powwow-lifecycle-hook-DO-NOT-DELETE