-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
Current Behavior
When opening a modal from a popover click event, if that modal has form fields, the first one is given immediate focus, then immediately blurred, causing a flashing effect.
Expected Behavior
The input field in a modal opened by a popover does not receive focus then immediately blur.
Steps to Reproduce
Create an inline popover that has a child with a click event that opens a modal that contains an input field.
Page with popover
<template>
<ion-page>
<ion-content :fullscreen="true" color="light">
<ion-button @click="setOpen(true, $event)" shape="round" fill="clear" color="dark" size="small">
<ion-icon :icon="ellipsisVertical"></ion-icon>
</ion-button>
<ion-popover :is-open="isOpen" :event="locationEvent" :dismissOnSelect="true" @didDismiss="setOpen(false)">
<ion-item class="context-item" lines="full" @click="openModal">Test</ion-item>
</ion-popover>
</ion-content>
</ion-page>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { IonButton, IonPopover, IonIcon, IonPage, IonContent, modalController, IonItem } from '@ionic/vue';
import { ellipsisVertical } from 'ionicons/icons';
import ModalVue from './Modal.vue';
const isOpen = ref(false);
const locationEvent = ref<Event>();
function setOpen(state: boolean, event?: Event) {
locationEvent.value = event;
isOpen.value = state;
}
const openModal = async () => {
const modal = await modalController
.create({
component: ModalVue
})
modal.present();
await modal.onDidDismiss();
}
</script>
Modal.vue
<template>
<ion-item>
<ion-label position="floating">Label</ion-label>
<ion-input></ion-input>
</ion-item>
</template>
<script lang="ts" setup>
import { IonItem, IonLabel, IonInput } from '@ionic/vue';
</script>
Code Reproduction URL
https://github.com/raymer/ionic-bug
Ionic Info
Ionic:
Ionic CLI : 5.4.16 (C:\Users\rayme\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/vue 6.0.1
Capacitor:
Capacitor CLI : 3.2.4
@capacitor/core : 3.4.1
Utility:
cordova-res : not installed
native-run : 1.5.0
System:
NodeJS : v16.13.1 (C:\Program Files\nodejs\node.exe)
npm : 8.3.0
OS : Windows 10
Additional Information
No response