Hi there !
I was facing a problem, using ion-popover when i used it as a notification component. When the popover was showing the notification, the user had a delay without any focus and click event on the whole page. The behavior I was seeking for is the user can still click on any element in the background during popover display.
So, after so pain and tests, I share the code for anyone who want to achieve the same behavior.
Tested with Ionic 8 + Vue 3
Full example here : https://codesandbox.io/p/devbox/ztvy68
<ion-button id="custom-popover-trigger">Background clickable popover</ion-button>
<ion-popover
class="custom-popover"
:show-backdrop="false"
:backdrop-dismiss="false"
trigger="custom-popover-trigger"
:dismiss-on-select="true"
>
<ion-content>Hi there !</ion-content>
</ion-popover>
/* Trick to keep background focus */
ion-popover.custom-popover{
position: unset;
&::part(backdrop) {
display: none;
pointer-events: none;
}
}