File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,15 @@ export default class AbstractMenu extends Component {
163163 this . setState ( { selectedItem : null , forceSubMenuOpen : false } ) ;
164164 } ;
165165
166+ /**
167+ * Render all the children.
168+ * It has a `childIndexRef` parameter to be able to construct the child
169+ * indexes properly. A reference was needed for this function because this
170+ * is a recursive function that could mutate the index and pass it back to
171+ * the caller. That parameter should always be undefined while calling from
172+ * outside.
173+ * TODO: Rewrite this function in a way that we don't need this reference.
174+ */
166175 renderChildren = ( children , childIndexRef = { value : - 1 } ) =>
167176 React . Children . map ( children , ( child ) => {
168177 let currentChildIndexRef = childIndexRef ;
Original file line number Diff line number Diff line change @@ -313,7 +313,7 @@ describe('ContextMenu tests', () => {
313313 type : MenuItem
314314 } ) ;
315315
316- // Press enter select it.
316+ // Press enter to select it.
317317 document . dispatchEvent ( enter ) ;
318318 // The selected item should be preserved and not reset.
319319 expect ( component . state ( ) . selectedItem ) . toEqual ( {
You can’t perform that action at this time.
0 commit comments