packages/material-ui/src/Modal/ModalManager.ts/ModalManager/isTopModal
class ModalManager:  isTopModal(modal: Modal): boolean {
    return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;
  }