Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: ion-datetime time picker incorrectly positioned when rapidly opened or in React/Vue inline ion-popover #24415

Closed
4 of 6 tasks
amiraiouaz opened this issue Dec 15, 2021 · 6 comments
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@amiraiouaz
Copy link

amiraiouaz commented Dec 15, 2021

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

Hello,

First of all, I want to thank you for this great framework.

I just started an ionic project with the version 6.x (with Vue.js) and I am having a little issue with the time popover when I use the ion-datetime in a popover:

image

This is my code:

<ion-item
    id="datepicker"
    button
    detail="false"
  >
    <ion-icon
      slot="end"
      :icon="calendarOutline"
    />
    <ion-popover
      trigger="datepicker"
      size="cover"
      show-backdrop="false"
      translucent
    >
      <ion-datetime
        first-day-of-week="1"
        hour-cycle="h23"
        size="cover"
        show-default-time-label="false"
        :presentation="presentation"
        :locale="locale"
      />
    </ion-popover>
</ion-item>

Expected Behavior

This should be the expected position:

Steps to Reproduce

  • Click on ion-item
  • Click on time button
  • Position is not correct

I am doing something wrong or is this a bug?

Thanks a lot in advance for your help.

Code Reproduction URL

Ionic Info

My package.json:

  "dependencies": {
    "@capacitor/app": "1.0.7",
    "@capacitor/core": "3.3.3",
    "@capacitor/haptics": "1.1.3",
    "@capacitor/keyboard": "1.2.0",
    "@capacitor/status-bar": "1.0.6",
    "@capacitor/storage": "^1.2.3",
    "@ionic/vue": "^6.0.0",
    "@ionic/vue-router": "^6.0.0",
    "core-js": "^3.6.5",
    "vue": "^3.2.21",
    "vue-router": "^4.0.12"
  }

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Dec 15, 2021
@sean-perkins sean-perkins self-assigned this Dec 15, 2021
@sean-perkins
Copy link
Contributor

Thanks for reporting this issue! I've been able to reproduce the behavior here: https://github.com/sean-perkins/datetime-gh-24415.

On an initial look, I believe it's a side effect of nested popover usages. We use popover internally for the time picker and popovers are position fixed by default.

We'll track this issue as a bug.

@sean-perkins sean-perkins added package: core @ionic/core package type: bug a confirmed bug report labels Dec 15, 2021
@ionitron-bot ionitron-bot bot removed the triage label Dec 15, 2021
@sean-perkins sean-perkins removed their assignment Dec 15, 2021
@sean-perkins sean-perkins added package: vue @ionic/vue package package: react @ionic/react package and removed package: core @ionic/core package labels Dec 16, 2021
@sean-perkins
Copy link
Contributor

sean-perkins commented Dec 16, 2021

This issue is only present in the React and Vue implementations. I believe it's a custom elements issue. Will share more soon.

  • The time picker popover is also positioning relative to the parent popover, instead of the click target of the time picker element.
  • Calling .click() manually on the button target produces the same result in an Angular environment.
  • Possible to replicate in Angular by rapidly clicking the time picker

Edit:

This issue is reproducible from Core by rapidly clicking the time picker inside the datetime. Regardless of the ion-popover.

@sean-perkins sean-perkins added package: core @ionic/core package and removed package: vue @ionic/vue package package: react @ionic/react package labels Dec 16, 2021
@sean-perkins sean-perkins changed the title bug: ion-datetime in popover creates issue with time popover position bug: ion-datetime time picker incorrectly position when rapidly opened or in React/Vue inline ion-popover Dec 16, 2021
@sean-perkins sean-perkins changed the title bug: ion-datetime time picker incorrectly position when rapidly opened or in React/Vue inline ion-popover bug: ion-datetime time picker incorrectly positioned when rapidly opened or in React/Vue inline ion-popover Dec 16, 2021
@creatxrgithub
Copy link

creatxrgithub commented Dec 22, 2021

time picker position problem with web browser

import React, { useState, useRef } from 'react'; import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar, IonDatetime } from '@ionic/react'; import ExploreContainer from '../components/ExploreContainer'; import './Tab1.css'; const Tab1: React.FC = () => { const [selectedDate, setSelectedDate] = useState(''); return ( <IonPage> <IonHeader> <IonToolbar> <IonTitle>Tab 1</IonTitle> </IonToolbar> </IonHeader> <IonContent fullscreen> <IonHeader collapse="condense"> <IonToolbar> <IonTitle size="large">Tab 1</IonTitle> </IonToolbar> </IonHeader> <IonDatetime hour-cycle="h23" locale="en-GB" value={selectedDate} onIonChange={e => setSelectedDate(e.detail.value!)}></IonDatetime> </IonContent> </IonPage> ); }; export default Tab1;

time_picker_position_problem

@mixalbl4-127
Copy link

mixalbl4-127 commented Jan 7, 2022

#24535
I fix it
@liamdebeasi

@liamdebeasi
Copy link
Contributor

Hi everyone,

This issue was was fixed in Ionic 6.0.4 but we missed closing out the issue. Please update your apps to the latest version of Ionic to receive this fix. Thanks!

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 15, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

5 participants