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

datepicker popup return the focus to the wrong element #6069

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

frenkelor
Copy link

datepicker popup return the focus to the wrong element after setting
close-on-date-selection=true
datepicker-append-to-body=true
uid-datepicker-popup return the focus to the root uipicker element instead of the input.
this made after this commit

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.

close-on-date-selection=true
datepicker-append-to-body=true
uid-datepicker-popup return the focus to the root uipicker element instead of the input.
@frenkelor
Copy link
Author

This solution as side effects on IE11 i'm working to fix them or to came with another solution

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.

2 participants