@@ -6,6 +6,7 @@ var cloneWithProps = require('react/lib/cloneWithProps');
66var MenuTrigger = require ( './MenuTrigger' ) ;
77var MenuOptions = require ( './MenuOptions' ) ;
88var MenuOption = require ( './MenuOption' ) ;
9+ var uuid = require ( '../helpers/uuid' ) ;
910var injectCSS = require ( '../helpers/injectCSS' ) ;
1011var buildClassName = require ( '../mixins/buildClassName' ) ;
1112
@@ -19,8 +20,21 @@ var Menu = module.exports = React.createClass({
1920
2021 mixins : [ buildClassName ] ,
2122
23+ childContextTypes : {
24+ id : React . PropTypes . string ,
25+ active : React . PropTypes . bool
26+ } ,
27+
28+ getChildContext : function ( ) {
29+ return {
30+ id : this . state . id ,
31+ active : this . state . active
32+ } ;
33+ } ,
34+
2235 getInitialState : function ( ) {
2336 return {
37+ id : uuid ( ) ,
2438 active : false ,
2539 selectedIndex : 0 ,
2640 horizontalPlacement : 'right' , // only 'right' || 'left'
@@ -93,8 +107,9 @@ var Menu = module.exports = React.createClass({
93107 React . Children . forEach ( this . props . children , function ( child ) {
94108 if ( child . type === MenuTrigger . type ) {
95109 trigger = cloneWithProps ( child , {
96- onToggleActive : this . handleTriggerToggle ,
97- ref : 'trigger'
110+ ref : 'trigger' ,
111+ owns : this . state . id ,
112+ onToggleActive : this . handleTriggerToggle
98113 } ) ;
99114 }
100115 } . bind ( this ) ) ;
@@ -103,9 +118,6 @@ var Menu = module.exports = React.createClass({
103118 } ,
104119
105120 renderMenuOptions : function ( ) {
106- if ( ! this . state . active ) {
107- return null ;
108- }
109121 var options ;
110122 if ( this . verifyTwoChildren ( ) ) {
111123 React . Children . forEach ( this . props . children , function ( child ) {
@@ -127,7 +139,6 @@ var Menu = module.exports = React.createClass({
127139 return (
128140 < div
129141 className = { this . buildClassName ( 'Menu' ) }
130- role = 'menu'
131142 onKeyDown = { this . handleKeys }
132143 onBlur = { this . handleBlur }
133144 >
0 commit comments