diff --git a/awx/ui/client/components/input/select.directive.js b/awx/ui/client/components/input/select.directive.js index 599b89d284..4bd605df44 100644 --- a/awx/ui/client/components/input/select.directive.js +++ b/awx/ui/client/components/input/select.directive.js @@ -1,20 +1,29 @@ +let eventService; +let pathService; + function link (scope, el, attrs, form) { form.use(scope, el); + let apply = eventService.listenWith(scope); + let input = el.find('input')[0]; let select = el.find('select')[0]; - input.addEventListener('focus', () => select.focus()); - select.addEventListener('focus', () => input.classList.add('at-Input--focus')); - select.addEventListener('mousedown', () => scope.open = !scope.open); - select.addEventListener('change', () => scope.open = false ); - select.addEventListener('blur', () => { - input.classList.remove('at-Input--focus') + input.addEventListener('focus', apply(select.focus)); + select.addEventListener('mousedown', apply(() => scope.open = !scope.open)); + select.addEventListener('change', () => apply(() => scope.open = false)); + select.addEventListener('focus', apply(() => input.classList.add('at-Input--focus'))); + + select.addEventListener('blur', apply(() => { + input.classList.remove('at-Input--focus'); scope.open = scope.open && false; - }); + })); } -function atInputSelect (pathService) { +function atInputSelect (_eventService_, _pathService_) { + eventService = _eventService_; + pathService = _pathService_; + return { restrict: 'E', transclude: true, @@ -29,6 +38,9 @@ function atInputSelect (pathService) { }; } -atInputSelect.$inject = ['PathService']; +atInputSelect.$inject = [ + 'EventService', + 'PathService' +]; export default atInputSelect; diff --git a/awx/ui/client/components/panel/heading.partial.html b/awx/ui/client/components/panel/heading.partial.html index 50f50327b1..1f5b2ed682 100644 --- a/awx/ui/client/components/panel/heading.partial.html +++ b/awx/ui/client/components/panel/heading.partial.html @@ -1,10 +1,10 @@