How MUI control clicking outside of a component, the component itself will close?

I’m learning MUI 5 component design. Can anyone tell me where is the logic that control clicking outside of a component, the component itself will close?

I couldn’t find it from the souce code.

It has applied on select component and dialog component.