MDL-70075 core: Listen for the `focus` and `blur` events again
[moodle.git] / lib / amd / src / custom_interaction_events.js
index 84f09d2..c429e92 100644 (file)
@@ -431,16 +431,18 @@ define(['jquery', 'core/key_codes'], function($, keyCodes) {
                 triggerEvent(events.accessibleChange, e);
             });
         } else {
-            element.on('focusin', function(e) {
+            var nativeElement = element.get()[0];
+            // The `focus` and `blur` events do not support bubbling. Use Event Capture instead.
+            nativeElement.addEventListener('focus', function(e) {
                 $(e.target).data('initValue', e.target.value);
-            });
-            element.on('focusout', function(e) {
+            }, true);
+            nativeElement.addEventListener('blur', function(e) {
                 var initValue = $(e.target).data('initValue');
                 $(e.target).removeData('initValue');
                 if (e.target.value !== initValue) {
                     triggerEvent(events.accessibleChange, e);
                 }
-            });
+            }, true);
             element.on('keydown', function(e) {
                 if ((e.which === keyCodes.enter) && e.target.value !== $(e.target).data('initValue')) {
                     triggerEvent(events.accessibleChange, e);