Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

fix(datepicker): ensure datepicker is focused #5761

Closed
wants to merge 1 commit into from

Conversation

wesleycho
Copy link
Contributor

  • When date is selected, ensure datepicker is selected in Chrome

Plunker with fix in action here.

This fixes #5754

- When date is selected, ensure datepicker is selected in Chrome
@deeg
Copy link
Contributor

deeg commented Apr 6, 2016

This LGTM if you don't want a test added.

I wonder why it was working for me on an older version of OSX.

@wesleycho
Copy link
Contributor Author

Not going to bother right now since this requires infrastructure for cross-browser testing to even write a meaningful test.

@wesleycho wesleycho closed this in 33cbd0f Apr 6, 2016
@wesleycho wesleycho deleted the fix/datepicker-chrome branch April 6, 2016 20:33
@frenkelor
Copy link

Hi @wesleycho
This fix cause a regression with the focused element in uid-datepicker-popup which gives the wrong element the focus.

way to reproduce:
close-on-date-selection=true
datepicker-append-to-body=true

  1. click on input to select a date
  2. select a date from the list

Observe :

On line the focus suppose to return to the input element but after your fix the focus is being set to the table which is being removed from the DOM after clicking on the button and the focus is passed to the parent element the body.

So i returned to the original issue #5754 and tried to understand why ng-keydown is not being fired.
I realized that after clicking on date button the focused element is the button itself and because ng-keydown is being set to self.element[0] keydown event is not being invoked.

I managed to come with 2 solutions to this problem:

  1. you can add to the element that holds the keydown a contenteditable="true" attribute and it's solving the problems because now ng-keydown is being invoked on any of self.element[0] children's.
  2. you can set the keydown with jquery selector that includes self.element[0]; children's and the self.element[0] itself.

I think the first approach it's better then the other.
i created this plunker to illustrate the first approach.

Do you want me to create a pull request for that fix?

@wesleycho
Copy link
Contributor Author

Sure, file a PR with the first approach - I'm a little tired, so I'm a bit confused. It would be better to get a sense of what you mean in code.

@frenkelor
Copy link

@wesleycho , i created a PR

@udayraj90
Copy link

udayraj90 commented Mar 31, 2017

@frenkelor can you please explain me exactly where to put this code change and in which file.

I tried it to change in datepicker.js but it doesn't work for me.

@frenkelor
Copy link

after another iteration on that i decided to leave this bug my fix is not working for IE 11

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

Successfully merging this pull request may close these issues.

Datepicker keyboard navigation on Chrome doesn't work
4 participants