@@ -48,7 +48,6 @@ class Dropdown extends React.Component {
4848 this . state = { } ;
4949
5050 this . lastOpenEventType = null ;
51- this . isKeyboardClick = false ;
5251 }
5352
5453 componentDidMount ( ) {
@@ -83,7 +82,7 @@ class Dropdown extends React.Component {
8382 let children = this . extractChildren ( ) ;
8483 let Component = this . props . componentClass ;
8584
86- let props = omit ( this . props , [ 'id' ] ) ;
85+ let props = omit ( this . props , [ 'id' , 'role' ] ) ;
8786
8887 const rootClasses = {
8988 open : this . props . open ,
@@ -120,8 +119,7 @@ class Dropdown extends React.Component {
120119 return ;
121120 }
122121
123- this . toggleOpen ( this . isKeyboardClick ? 'keydown' : 'click' ) ;
124- this . isKeyboardClick = false ;
122+ this . toggleOpen ( 'click' ) ;
125123 }
126124
127125 handleKeyDown ( event ) {
@@ -142,10 +140,6 @@ class Dropdown extends React.Component {
142140 case keycode . codes . tab :
143141 this . handleClose ( event ) ;
144142 break ;
145- case keycode . codes . space :
146- case keycode . codes . enter :
147- this . isKeyboardClick = true ;
148- break ;
149143 default :
150144 }
151145 }
@@ -166,7 +160,7 @@ class Dropdown extends React.Component {
166160
167161 if (
168162 this . lastOpenEventType === 'keydown' ||
169- this . props . alwaysFocusNextOnOpen
163+ this . props . role === 'menuitem'
170164 ) {
171165 menu . focusNext ( ) ;
172166 }
@@ -227,7 +221,8 @@ class Dropdown extends React.Component {
227221 let toggleProps = {
228222 open,
229223 id : this . props . id ,
230- ref : TOGGLE_REF
224+ ref : TOGGLE_REF ,
225+ role : this . props . role
231226 } ;
232227
233228 toggleProps . onClick = createChainedFunction (
@@ -327,9 +322,10 @@ Dropdown.propTypes = {
327322 onSelect : React . PropTypes . func ,
328323
329324 /**
330- * Focus first menu item on menu open on all events, not just keydown events.
325+ * If `'menuitem'`, causes the dropdown to behave like a menu item rather than
326+ * a menu button.
331327 */
332- alwaysFocusNextOnOpen : React . PropTypes . bool
328+ role : React . PropTypes . string
333329} ;
334330
335331Dropdown = uncontrollable ( Dropdown , { open : 'onToggle' } ) ;
0 commit comments