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

Can't Open With Keyboard #501

Open
scriptype opened this issue May 22, 2018 · 9 comments
Open

Can't Open With Keyboard #501

scriptype opened this issue May 22, 2018 · 9 comments

Comments

@scriptype
Copy link

I've tried pressing space, enter, and down arrow key to open datepicker popup. None worked. I couldn't see anything related to keyboard events or manually triggering in docs, either. I think there should be some way to use datepicker with only keyboard.

Maybe this can help: https://www.w3.org/blog/wai-components-gallery/widget/datepicker/

@aledujke
Copy link

Is there a plan to add keyboard support? I'm baffled that there is not a single mention about it.

@chriszrc
Copy link

At a minimum, it should be possible to at least tab to the optional calendar-button, which could provide an option to support keyboard navigation. It would also be nice if there was some way to select a date as well with the keyboard once the calendar has opened

@adabutch
Copy link

adabutch commented Jan 29, 2019

Anyone know of plans to address this?

(or know of a Fork/PR that already has?)

@aledujke
Copy link

aledujke commented Feb 1, 2019

I made some changes to enable keyboard support, it's very... proof of concept-ish, It works okay but is far from being ready for a PR or something.

https://github.com/aledujke/vuejs-datepicker/tree/keyboard-support

@fredikey
Copy link

fredikey commented Mar 1, 2019

@aledujke Sorry for this maybe stupid question.. What i need to install your fork as node module for my project?

@aledujke
Copy link

aledujke commented Mar 4, 2019

@fredikey
Clone my fork, then checkout the keyboard_support branch and run "yarn build", then take a look at dist folder. Copy locale folder and vuejs-datepicker.esm.js from it to some folder in your project, then rename "vuejs-datepicker.esm.js" to index.js

Then import it like this:
import Datepicker from '@/utils/datepicker/'
import { srCYRL } from '@/utils/datepicker/locale'

You will then have a build with support to open on enter, or arrow keys. Arrow keys also move the selection of date once it's opened.

What does not work currently is proper handling of disabled dates. I don't look up to see if the date I'm trying to select is selectable or not and so you can select a disabled date.

The inbuilt tests are all passing so I'm hopeful that I'm not introducing some bug.

The code I added is hacky and DRY :/

As it turns out I don't need arrow key support and so I will not continue to work on it and try and to make a proper PR. My priority is adding input formatting support. Which I already did actually, it's on the separate branch of that same repo. But I'm not sure what is going on with the maintainer and if they are even willing to consider a PR

@aledujke
Copy link

aledujke commented Mar 4, 2019

One more thing!

If you comment out the lines in Datepicker.vue:460-462 you would be able to use arrow key's along with typeable calendar. I disabled it cause it did not make sense to me to have both enabled. You will lose the ability to move cursor left and right in the input field.

Also before doing "yarn build" you have to install yarn globally and then ran "yarn install" like you would normally do "npm install" to install dependencies needed for the build etc.

@renestalder
Copy link

renestalder commented Jul 8, 2019

Oh uff, someone mind to add this as a big note to the readme that there is no keyboard support? I expect keyboard support to be the standard. Quite surprised after implementation that there is not even the minimal amount of keyboard support. Would be nice others don't have to find out that late as I did.

@mst101
Copy link

mst101 commented Apr 27, 2022

Good news! If you're looking for a fork of this vuejs-datepicker project which has implemented keyboard support, check this out:

https://sumcumo.github.io/vue-datepicker/

It was a lot more difficult than I expected - and has taken me well over a year to complete (elapsed time) - but you can now interact with the datepicker using spacebar, tab, enter, escape, backspace, delete as well as the arrow keys.

We tried to emulate the way Chrome implements <input type="date"> (see example) i.e. by 'focus-trapping' certain elements (which you can tab through) when the calendar is open.

You now even get a nice slide transition when changing month/year/decade - and the functionality is backed up by a suite of e2e tests in Cypress / cucumber.

Give it a try - and if you like it, give us a little star. It'll make us happy ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants