ember-basic-dropdown
Advanced tools
Comparing version 0.9.5-beta.9 to 0.9.5-beta.10
@@ -19,2 +19,3 @@ import Ember from 'ember'; | ||
initiallyOpened: false, | ||
hasFocusInside: false, | ||
verticalPosition: 'auto', // above | below | ||
@@ -24,3 +25,8 @@ horizontalPosition: 'auto', // right | left | ||
attributeBindings: ['dir'], | ||
classNameBindings: ['renderInPlace:ember-basic-dropdown--in-place', '_verticalPositionClass', '_horizontalPositionClass'], | ||
classNameBindings: [ | ||
'renderInPlace:ember-basic-dropdown--in-place', | ||
'hasFocusInside:ember-basic-dropdown--focus-inside', | ||
'_verticalPositionClass', | ||
'_horizontalPositionClass' | ||
], | ||
@@ -53,4 +59,4 @@ // Lifecycle hooks | ||
trigger.addEventListener('touchend', e => { | ||
this.send('handleTouchEnd', e) | ||
e.preventDefault(); // Prevent synthetic click | ||
this.send('handleTouchEnd', e) | ||
}); | ||
@@ -79,2 +85,11 @@ } | ||
// Events | ||
focusIn(e) { | ||
this.send('handleFocusIn', e); | ||
}, | ||
focusOut(e) { | ||
this.send('handleFocusOut', e); | ||
}, | ||
// CPs | ||
@@ -133,3 +148,11 @@ appRoot: computed(function() { | ||
if (onFocus) { onFocus(this.get('publicAPI'), e); } | ||
} | ||
}, | ||
handleFocusIn() { | ||
this.set('hasFocusInside', true); | ||
}, | ||
handleFocusOut() { | ||
this.set('hasFocusInside', false); | ||
}, | ||
}, | ||
@@ -136,0 +159,0 @@ |
@@ -38,2 +38,6 @@ import WormholeComponent from 'ember-wormhole/components/ember-wormhole'; | ||
let dropdown = self.window.document.getElementById(this.get('dropdownId')); | ||
if (!this.get('renderInPlace')) { | ||
dropdown.addEventListener('focusin', this.get('onFocusIn')); | ||
dropdown.addEventListener('focusout', this.get('onFocusOut')); | ||
} | ||
run.schedule('afterRender', this, function() { | ||
@@ -57,2 +61,5 @@ dropdown.classList.add('ember-basic-dropdown--transitioning-in'); | ||
parentElement = parentElement.parentElement; | ||
} else { | ||
dropdown.removeEventListener('focusin', this.get('onFocusIn')); | ||
dropdown.removeEventListener('focusout', this.get('onFocusOut')); | ||
} | ||
@@ -59,0 +66,0 @@ clone.id = clone.id + '--clone'; |
{ | ||
"name": "ember-basic-dropdown", | ||
"version": "0.9.5-beta.9", | ||
"version": "0.9.5-beta.10", | ||
"description": "The default blueprint for ember-cli addons.", | ||
@@ -5,0 +5,0 @@ "directories": { |
Sorry, the diff of this file is not supported yet
6155569
73493