Search code examples
sapui5

Prevent sap.m.popover from closing on click


How do I prevent sap.m.popover from closing when the user clicks somewhere else on the page? Is there any solution to this requirement? I was not able to finde anything regarding this in the documentation.

Can someone point me in the right direction, please?


Solution

  • Isnt the property modal what you are looking for?

    The popover will not be closed when tapping outside the popover. It also blocks any interaction with the background. The default value is false.

    Check the demo kit for the modal property. The Demo-kit is really something you should often use, it could help you a lot.

    <Popover title="Test" class="sapUiContentPadding" placement="Bottom" modal="true">
        //whatever you want inside your popover
        <footer>
            <Toolbar>
                <ToolbarSpacer/>
                <Button
                    id="close"
                    text="Close"
                    press="handlClosePress" />
            </Toolbar>
        </footer>
    </Popover>