Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

tabs(pagination): adding a new tab on mobile causes two tabs to be created #11725

Closed

Description

@Splaktar

Bug, enhancement request, or proposal:

Bug

CodePen and steps to reproduce the issue:

CodePen Demo which demonstrates the issue:

https://material.angularjs.org/HEAD/demo/tabs

Detailed Reproduction Steps:

  1. Go to the Dynamic Tabs and pagination demo
  2. Add a new tab

What is the expected behavior?

1 new tab is created

What is the current behavior?

2 duplicate tabs are created

What is the use-case or motivation for changing an existing behavior?

It's a bug.

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.7.6
  • AngularJS Material: 1.1.19 (HEAD)
  • OS: Android 9, iOS 12.2
  • Browsers: Chrome for Android 73, iOS Safari

Is there anything else we should know? Stack Traces, Screenshots, etc.

  • This only happens on mobile with Chrome and Safari.
  • This does not occur on Firefox for Android.
  • This does not occur on Chrome, Safari, or Firefox for macOS, but there is a bit of a flicker to the animation that almost looks like a second tab is added and removed quickly on Safari and Firefox.
  • This can be reproduced in the Chrome DevTools mobile emulator

Screenshot_20190518-151653

Reported by @gauravlodha in #11711 (comment).

Activity

  1. added
    needs: investigation
    severity: regression
    P1: urgent
    on May 18, 2019
  2. added this to the 1.1.19 milestone on May 18, 2019
  3. self-assigned this
    on May 18, 2019
  4. added
    os: iOS
    os: Android
    and removed on May 18, 2019
  5. Splaktar commented on May 18, 2019

    @Splaktar
    ContributorAuthor

    This is reproducible on the 1.1.11 tabs demo.

  6. removed
    needs: investigation
    on May 18, 2019
  7. Splaktar commented on May 18, 2019

    @Splaktar
    ContributorAuthor

    Actually, I didn't go back far enough. This is reproducible in the 1.1.6 tabs demo.

  8. Splaktar commented on May 18, 2019

    @Splaktar
    ContributorAuthor

    And with some more testing, I was able to reproduce this as far back as 1.1.4.

  9. Splaktar commented on May 18, 2019

    @Splaktar
    ContributorAuthor

    This appears to be caused by eecc541 which made a change to gesture handling. Using $mdGestureProvider.skipClickHijack(); in your application's config seems to work around this issue.

  10. Splaktar commented on May 18, 2019

    @Splaktar
    ContributorAuthor

    Lots of related discussion in #3990 and PR #10189.

  11. Splaktar commented on May 20, 2019

    @Splaktar
    ContributorAuthor

    It looks like the "fix" in eecc541 was to work around the fact that our isKeyClick logic does not work on iOS Safari:

    function clickHijacker(ev) {
    var isKeyClick = ev.clientX === 0 && ev.clientY === 0;

    While MouseEvent.clientX and MouseEvent.clientY are 0 for Enter key submit events in Chrome, they are set to values matching the actual position of the mouse/touch on iOS.

    The workaround in eecc541, only helps fix the case where the event is dispatched by an element with type="submit" like when pressing Enter in an input field on a form with a submit button. However, it doesn't keep the clickHijacker from capturing and stopping propagation on other iOS key presses that generate click events.

    We have the same bad check in

    function mouseInputHijacker(ev) {
    var isKeyClick = !ev.clientX && !ev.clientY;

    It's not clear how we can differentiate click events that were triggered by a "KeyClick" and those that were not on iOS. The only difference that I can see between the two events is the webkitForce value being 1 on a button press and 0 on the Enter key.

  12. added a commit that references this issue on May 20, 2019
    a195562
  13. Splaktar commented on May 20, 2019

    @Splaktar
    ContributorAuthor

    I tried out the webkitForce workaround and it seems to work well on iOS and Android, but needs some additional testing from the community. Please try out this branch (https://github.com/angular/material/tree/gesture-fixDoubleSubmit) and provide feedback.

    Tested on

    • Firefox
    • Chrome
    • Chrome for Android
    • iOS Safari
    • macoS Safari

    I'll try to get a PR up for this tomorrow, but I need to

    • add checks for browser support of new MouseEvent() and new CustomEvent() and fallbacks
    • Test on IE11
  14. added 2 commits that reference this issue on May 23, 2019
    69bb3e5
    75960f6
  15. added
    has: Pull Request
    on May 23, 2019
  16. added a commit that references this issue on May 30, 2019
    f6f4848
  17. added a commit that references this issue on May 30, 2019
    244619a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1: urgentbrowser: Chromebrowser: Safarihas: Pull Requestos: Androidos: iOSresolution: fixedseverity: regressiontype: bugui: mobile

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions