Skip to content

Revert "Fix Picklist in Modal + EventUtil for Testing" #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions components/SLDSPicklistBase/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,7 @@ module.exports = React.createClass( {
this.setState({isOpen:false})
}
}
/* resolve a double click issue with the modal */
} else if (this.props.modal && this.state.isFocused && prevState.isFocused) {
if (!this.state.isOpen) {
this.setState({isOpen : true});
}
}
}


if(this.props.value !== prevProps.value){
Expand Down
10 changes: 4 additions & 6 deletions components/SLDSPicklistBase/list-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = React.createClass({
this.props.onMoveFocus(-1);
}
}
else if(event.keyCode === KEYS.ENTER ||
else if(event.keyCode === KEYS.ENTER ||
event.keyCode === KEYS.SPACE ){
EventUtil.trapEvent(event);
if(this.props.onSelect){
Expand All @@ -116,9 +116,7 @@ module.exports = React.createClass({
},

handleBlur(e) {
if (this.props.onBlur &&
this.refs.link.getDOMNode() !== e.target) {

if(this.props.onBlur){
this.props.onBlur(this.props.index, e.relatedTarget);
}
},
Expand All @@ -132,15 +130,15 @@ module.exports = React.createClass({

render () {
return (
<li
<li

className={"slds-dropdown__item slds-has-icon slds-has-icon--left slds-theme--"+this.props.theme}
onMouseDown={this.handleMouseDown}
tabIndex={-1}>
<a id={'menu-0-'+this.props.index}
href=''
ref='link'
className='slds-truncate'
className='slds-truncate'
onClick={this.handleClick}
onMouseDown={this.handleMouseDown}
onKeyDown={this.handleKeyDown}
Expand Down
10 changes: 3 additions & 7 deletions components/utils/EventUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ const EventUtil = {
trapEvent(event){
event.preventDefault();
event.stopPropagation();

if(event.nativeEvent && event.nativeEvent.preventDefault){
if(event.nativeEvent){
event.nativeEvent.preventDefault();
}

if (event.nativeEvent && event.nativeEvent.stopPropagation){
event.nativeEvent.stopPropagation();
}
},
Expand All @@ -31,12 +27,12 @@ const EventUtil = {
},

trapImmediate(event){
if(event.nativeEvent && event.nativeEvent.stopImmediatePropagation){
if(event.nativeEvent){
event.nativeEvent.stopImmediatePropagation();
}
EventUtil.trap(event);
}

};

module.exports = EventUtil;
module.exports = EventUtil;