(props, context)
| 6466 | }; |
| 6467 | |
| 6468 | function Dropdown(props, context) { |
| 6469 | var _this; |
| 6470 | |
| 6471 | _this = _React$Component.call(this, props, context) || this; |
| 6472 | |
| 6473 | _this.handleClick = function (event) { |
| 6474 | _this.toggleOpen(event); |
| 6475 | }; |
| 6476 | |
| 6477 | _this.handleKeyDown = function (event) { |
| 6478 | var key = event.key, |
| 6479 | target = event.target; // Second only to https://github.com/twbs/bootstrap/blob/8cfbf6933b8a0146ac3fbc369f19e520bd1ebdac/js/src/dropdown.js#L400 |
| 6480 | // in inscrutability |
| 6481 | |
| 6482 | var isInput = /input|textarea/i.test(target.tagName); |
| 6483 | |
| 6484 | if (isInput && (key === ' ' || key !== 'Escape' && _this.menu.contains(target))) { |
| 6485 | return; |
| 6486 | } |
| 6487 | |
| 6488 | _this._lastSourceEvent = event.type; |
| 6489 | |
| 6490 | switch (key) { |
| 6491 | case 'ArrowUp': |
| 6492 | { |
| 6493 | var next = _this.getNextFocusedChild(target, -1); |
| 6494 | |
| 6495 | if (next && next.focus) next.focus(); |
| 6496 | event.preventDefault(); |
| 6497 | return; |
| 6498 | } |
| 6499 | |
| 6500 | case 'ArrowDown': |
| 6501 | event.preventDefault(); |
| 6502 | |
| 6503 | if (!_this.props.show) { |
| 6504 | _this.toggleOpen(event); |
| 6505 | } else { |
| 6506 | var _next = _this.getNextFocusedChild(target, 1); |
| 6507 | |
| 6508 | if (_next && _next.focus) _next.focus(); |
| 6509 | } |
| 6510 | |
| 6511 | return; |
| 6512 | |
| 6513 | case 'Escape': |
| 6514 | case 'Tab': |
| 6515 | _this.props.onToggle(false, event); |
| 6516 | |
| 6517 | break; |
| 6518 | |
| 6519 | default: |
| 6520 | } |
| 6521 | }; |
| 6522 | |
| 6523 | _this._focusInDropdown = false; |
| 6524 | _this.menu = null; |
| 6525 | _this.state = { |
nothing calls this directly
no test coverage detected
searching dependent graphs…