From 5cfb11641c67fc18cc14a5aa84c486d05526fee0 Mon Sep 17 00:00:00 2001 From: gerard Date: Thu, 28 Jun 2018 15:30:11 +0200 Subject: [PATCH] Tarea #373, Tarea #352 focus on first input popover --- client/core/src/components/popover/popover.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/core/src/components/popover/popover.js b/client/core/src/components/popover/popover.js index afc1f7c4e..bfdaaaed6 100644 --- a/client/core/src/components/popover/popover.js +++ b/client/core/src/components/popover/popover.js @@ -75,6 +75,15 @@ export default class Popover extends Component { this.document.addEventListener('keydown', this.docKeyDownHandler); 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.relocate();