Listen to focus events on children and add a focused class in the dropdown (#2848)

This commit is contained in:
Sam El-Husseini
2019-08-16 16:29:34 -07:00
committed by GitHub
parent ca83f97074
commit 8e4d904095

View File

@@ -145,6 +145,15 @@ Blockly.DropDownDiv.createDom = function() {
Blockly.DropDownDiv.DIV_.style.transition = 'transform ' +
Blockly.DropDownDiv.ANIMATION_TIME + 's, ' +
'opacity ' + Blockly.DropDownDiv.ANIMATION_TIME + 's';
// Handle focusin/out events to add a visual indicator when
// a child is focused or blurred.
div.addEventListener('focusin', function() {
Blockly.utils.dom.addClass(div, 'focused');
});
div.addEventListener('focusout', function() {
Blockly.utils.dom.removeClass(div, 'focused');
});
};
/**