Google Picker returns focus to element that was previously active

12 views
Skip to first unread message

Alan Wells

unread,
Jun 19, 2019, 1:51:24 PM6/19/19
to Google Apps Script Community
I decided to use the onfocus event in an input field to have the Google picker displayed.  I got that working, but I experienced an interesting situation with the Google picker continually being re-activated from the "onfocus" event of an input field.  As soon as the picker closed, and the picked value was put into the input field the picker was re-displayed.  I couldn't get the picker to not redisplay after the Select button in the picker was clicked.  So, I needed to change the event to ondblclick in the input tag to open the picker.  I'm guessing that the picker must reactivate the focus on the element that previously had the focus before the picker was displayed.  I'm just guessing.  The ondblclick event is better anyway.  If the user doesn't want the picker displayed, then they can click in the field without being bothered to close the picker.

Fernando Falcao

unread,
Jun 19, 2019, 2:05:40 PM6/19/19
to google-apps-sc...@googlegroups.com
Hi Alan!
What about to place a icon/image (representing the action that will be performed) by side your input field and then invoke the Google Picker when you click the icon/image? Would it help?

Regards,
Fernando

On Wed, Jun 19, 2019 at 2:51 PM Alan Wells <aj.a...@gmail.com> wrote:
I decided to use the onfocus event in an input field to have the Google picker displayed.  I got that working, but I experienced an interesting situation with the Google picker continually being re-activated from the "onfocus" event of an input field.  As soon as the picker closed, and the picked value was put into the input field the picker was re-displayed.  I couldn't get the picker to not redisplay after the Select button in the picker was clicked.  So, I needed to change the event to ondblclick in the input tag to open the picker.  I'm guessing that the picker must reactivate the focus on the element that previously had the focus before the picker was displayed.  I'm just guessing.  The ondblclick event is better anyway.  If the user doesn't want the picker displayed, then they can click in the field without being bothered to close the picker.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-script-community.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/afcb93e6-2454-4dad-8164-aca6d04d84dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alan Wells

unread,
Jun 19, 2019, 2:20:55 PM6/19/19
to Google Apps Script Community
That's a great idea.  I'd need to add a small icon to every row in a table.  Currently I have a placeholder note to double click for the picker.  Of course, I could have both, the double click, and an icon.
Reply all
Reply to author
Forward
0 new messages