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

datepicker to close using double tab in mobile phone #3174

Closed
stilist-dh opened this issue Dec 3, 2017 · 5 comments · Fixed by #5821
Closed

datepicker to close using double tab in mobile phone #3174

stilist-dh opened this issue Dec 3, 2017 · 5 comments · Fixed by #5821

Comments

@stilist-dh
Copy link

I using well this ngx bootstrap. but i have some issues about datepicker.
In my mobile phone, to close datepicker, i need to double tab.
how can i close datepicker with single tap??

@valorkin
Copy link
Member

valorkin commented Dec 3, 2017

Its know ios issue with hover
First tap - hover
Second - click
Fill be fixed
Closing as duplicate

@valorkin valorkin closed this as completed Dec 3, 2017
@danitt
Copy link

danitt commented Apr 11, 2018

if it helps anyone, you can also capture and extend the hover listener, to manually update the value or close the picker - hacky but works until a formalised solution is implemented

// component.html
<input type="text"
    class="form-control"
    #datePicker="bsDatepicker"
    (onShown)="onShowPicker($event)"
    bsDatepicker>
// component.ts
...
onShowPicker(container) {
    const dayHoverHandler = container.dayHoverHandler;
    const hoverWrapper = function($event) {
        const { cell, isHovered } = $event;
        // do whatever with hovered cell/event
        return dayHoverHandler($event);
    };
    container.dayHoverHandler = hoverWrapper;
}

@esoyke
Copy link

esoyke commented Apr 17, 2018

This was closed as a duplicate...of what issue?

@esoyke
Copy link

esoyke commented Apr 17, 2018

@danitt Thanks, I was able to resolve the mobile 'double-tap' issue by just modifying your function to set hover true, add this in place of your 'do whatever':
cell.isHovered=true;

@PeterStegnar
Copy link

PeterStegnar commented Mar 14, 2019

Solution that worked for me is:

  public onShowPicker(event) {
        const dayHoverHandler = event.dayHoverHandler;
        const hoverWrapper = ($event) => {
            const cell = $event;
            cell.isHovered = false;
            return dayHoverHandler($event);
        };
        event.dayHoverHandler = hoverWrapper;
  }

Point here is, that cell.isHovered should be set to false, because this is the very problem, that first touch is hovered then "click" on touch devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants