(props)
| 30245 | var FocusZone = /** @class */ function(_super) { |
| 30246 | (0, _tslib.__extends)(FocusZone1, _super); |
| 30247 | function FocusZone1(props) { |
| 30248 | var _this = _super.call(this, props) || this; |
| 30249 | _this._root = _react.createRef(); |
| 30250 | _this._mergedRef = (0, _utilities.createMergedRef)(); |
| 30251 | _this._onFocus = function(ev) { |
| 30252 | if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. |
| 30253 | return; |
| 30254 | var _a = _this.props, onActiveElementChanged = _a.onActiveElementChanged, // eslint-disable-next-line deprecation/deprecation |
| 30255 | doNotAllowFocusEventToPropagate = _a.doNotAllowFocusEventToPropagate, stopFocusPropagation = _a.stopFocusPropagation, // eslint-disable-next-line deprecation/deprecation |
| 30256 | onFocusNotification = _a.onFocusNotification, onFocus = _a.onFocus, shouldFocusInnerElementWhenReceivedFocus = _a.shouldFocusInnerElementWhenReceivedFocus, defaultTabbableElement = _a.defaultTabbableElement; |
| 30257 | var isImmediateDescendant = _this._isImmediateDescendantOfZone(ev.target); |
| 30258 | var newActiveElement; |
| 30259 | if (isImmediateDescendant) newActiveElement = ev.target; |
| 30260 | else { |
| 30261 | var parentElement = ev.target; |
| 30262 | while(parentElement && parentElement !== _this._root.current){ |
| 30263 | if ((0, _utilities.isElementTabbable)(parentElement) && _this._isImmediateDescendantOfZone(parentElement)) { |
| 30264 | newActiveElement = parentElement; |
| 30265 | break; |
| 30266 | } |
| 30267 | parentElement = (0, _utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS); |
| 30268 | } |
| 30269 | } |
| 30270 | // If an inner focusable element should be focused when FocusZone container receives focus |
| 30271 | if (shouldFocusInnerElementWhenReceivedFocus && ev.target === _this._root.current) { |
| 30272 | var maybeElementToFocus = defaultTabbableElement && typeof defaultTabbableElement === "function" && defaultTabbableElement(_this._root.current); |
| 30273 | // try to focus defaultTabbable element |
| 30274 | if (maybeElementToFocus && (0, _utilities.isElementTabbable)(maybeElementToFocus)) { |
| 30275 | newActiveElement = maybeElementToFocus; |
| 30276 | maybeElementToFocus.focus(); |
| 30277 | } else { |
| 30278 | // force focus on first focusable element |
| 30279 | _this.focus(true); |
| 30280 | if (_this._activeElement) // set to null as new active element was handled in method above |
| 30281 | newActiveElement = null; |
| 30282 | } |
| 30283 | } |
| 30284 | var initialElementFocused = !_this._activeElement; |
| 30285 | // If the new active element is a child of this zone and received focus, |
| 30286 | // update alignment an immediate descendant |
| 30287 | if (newActiveElement && newActiveElement !== _this._activeElement) { |
| 30288 | if (isImmediateDescendant || initialElementFocused) _this._setFocusAlignment(newActiveElement, true, true); |
| 30289 | _this._activeElement = newActiveElement; |
| 30290 | if (initialElementFocused) _this._updateTabIndexes(); |
| 30291 | } |
| 30292 | if (onActiveElementChanged) onActiveElementChanged(_this._activeElement, ev); |
| 30293 | if (stopFocusPropagation || doNotAllowFocusEventToPropagate) ev.stopPropagation(); |
| 30294 | if (onFocus) onFocus(ev); |
| 30295 | else if (onFocusNotification) onFocusNotification(); |
| 30296 | }; |
| 30297 | _this._onBlur = function() { |
| 30298 | _this._setParkedFocus(false); |
| 30299 | }; |
| 30300 | _this._onMouseDown = function(ev) { |
| 30301 | if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. |
| 30302 | return; |
| 30303 | var disabled = _this.props.disabled; |
| 30304 | if (disabled) return; |
nothing calls this directly
no test coverage detected