(e: FocusEvent)
| 267 | } |
| 268 | |
| 269 | onFocus(e: FocusEvent): void { |
| 270 | let activateButton = this.getCurrentActivateButton(); |
| 271 | let eventTarget = getEventTarget(e); |
| 272 | if (eventTarget === activateButton) { |
| 273 | // TODO: canceling this breaks the focus ring. Revisit when we support tabbing. |
| 274 | this.cancelEvent(e); |
| 275 | return; |
| 276 | } |
| 277 | |
| 278 | // Prevent focus events, except to the original drag target. |
| 279 | if (eventTarget !== this.dragTarget.element) { |
| 280 | this.cancelEvent(e); |
| 281 | } |
| 282 | |
| 283 | // Ignore focus events on the window/document (JSDOM). Will be handled in onBlur, below. |
| 284 | if (!(eventTarget instanceof HTMLElement) || eventTarget === this.dragTarget.element) { |
| 285 | return; |
| 286 | } |
| 287 | |
| 288 | let dropTarget = |
| 289 | this.validDropTargets.find(target => target.element === eventTarget) || |
| 290 | this.validDropTargets.find(target => nodeContains(target.element, eventTarget)); |
| 291 | |
| 292 | if (!dropTarget) { |
| 293 | // if (e.target === activateButton) { |
| 294 | // activateButton.focus(); |
| 295 | // } |
| 296 | if (this.currentDropTarget) { |
| 297 | this.currentDropTarget.element.focus(); |
| 298 | } else { |
| 299 | this.dragTarget.element.focus(); |
| 300 | } |
| 301 | return; |
| 302 | } |
| 303 | |
| 304 | let item = dropItems.get(eventTarget); |
| 305 | if (dropTarget) { |
| 306 | this.setCurrentDropTarget(dropTarget, item); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | onBlur(e: FocusEvent): void { |
| 311 | let activateButton = this.getCurrentActivateButton(); |
no test coverage detected