Issue glance focus/unfocus event

Is there an event sent to the issue glance event when the user is unfocusing and/or closing it?
If you put an auiSelect2 into the issue glance iframe, it will stay focused, even when you click outside the glance or close the glance. As a result the user cannot click any other jira form element, as the auiSelect2 is keeping the focus. (Chrome 81.0.4044.138)

2 Likes

For my specific case I came up with this solution:

        /**
         * When the use is leaving the glance we need to make sure to close the select2. If not it will keep its focus and break usage of jira.
         */
        $(document).on('focusout', function(event){
            //console.log(event)
            if ($(event.target).hasClass("select2-input")) {
              if ($('ul.select2-results:hover').length == 0) //only close if we are not inside the select 2 result list
                  AJS.$("#select2-fact-sheet").auiSelect2("close")
            }
        });

This code needs to be inside the iframe. It listens to the focusout event (which is a general browser event) and then close the select2 in case the user is not interacting with the result list.

However, a solution where the issue glance is informed specifically by the Jira cloud platform that it has lost focus would be much better.