azure-devops-ui
Version:
React components for building web UI in Azure DevOps
1 lines • 640 B
JavaScript
import{noop}from"../Util";import{getWindow}from"./Dom";function getTabIndex(t,e){return void 0!==t.tabIndex?t.tabIndex:t.disabled||t.excludeTabStop||e&&e.onFocus!==noop&&e.focusedElementId!==t.id?t.excludeFocusZone?void 0:-1:0}var targetToFocusOnNextRepaint=void 0;function focusAsync(t){targetToFocusOnNextRepaint?targetToFocusOnNextRepaint=t:(t=getWindow(targetToFocusOnNextRepaint=t))?t.requestAnimationFrame(function(){targetToFocusOnNextRepaint&&targetToFocusOnNextRepaint.focus(),targetToFocusOnNextRepaint=void 0}):setTimeout(function(){targetToFocusOnNextRepaint&&targetToFocusOnNextRepaint.focus()})}export{getTabIndex,focusAsync};