Tarea #373, Tarea #352 focus on first input popover

This commit is contained in:
gerard 2018-06-28 15:30:11 +02:00
parent 88033a7539
commit 5cfb11641c
1 changed files with 9 additions and 0 deletions

View File

@ -75,6 +75,15 @@ export default class Popover extends Component {
this.document.addEventListener('keydown', this.docKeyDownHandler); this.document.addEventListener('keydown', this.docKeyDownHandler);
this.document.addEventListener('focusin', this.docFocusInHandler); this.document.addEventListener('focusin', this.docFocusInHandler);
let firstFocusable = this.element.querySelector('input, textarea');
if (firstFocusable) {
firstFocusable.addEventListener('focus', () => {
firstFocusable.select();
});
setTimeout(() => {
firstFocusable.focus();
}, 200);
}
this.deregisterCallback = this.$transitions.onStart({}, () => this.hide()); this.deregisterCallback = this.$transitions.onStart({}, () => this.hide());
this.relocate(); this.relocate();