-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(List): new prop for enabling event propagation
- Loading branch information
Showing
9 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* eslint-disable no-console */ | ||
/* eslint-disable jsx-a11y/no-static-element-interactions */ | ||
import React from 'react'; | ||
import {Checkbox, List, ListItem} from '@momentum-ui/react'; | ||
|
||
export default class ListWithEventBubbling extends React.PureComponent { | ||
|
||
state = { | ||
enableBubbling: true | ||
}; | ||
|
||
onChange = (e) => { | ||
this.setState({ enableBubbling: e.target.checked }); | ||
}; | ||
|
||
bubbledEventHandler = (e) => { | ||
console.log(`KeyDown Event \nKeyCode: ${e.keyCode} \nKey: ${e.key}`); | ||
}; | ||
|
||
render() { | ||
return( | ||
<div> | ||
<div className="medium-4 columns" onKeyDown={this.bubbledEventHandler}> | ||
<List shouldPropagateKeyDown={this.state.enableBubbling}> | ||
<ListItem label='List Item 1' /> | ||
<ListItem label='List Item 2' /> | ||
<ListItem label='List Item 3' /> | ||
<ListItem label='List Item 4' /> | ||
</List> | ||
</div> | ||
<Checkbox | ||
checked={this.state.enableBubbling} | ||
onChange={this.onChange} | ||
label='Enable Event Bubbling (See Console)' | ||
htmlId={`checkbox-for-event-bubbling`} | ||
/> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters