Bug (?) in keyboard navigation tabs starter


#1

The tabs in the tabs starter project are supposed to activate their associated tab-panel when a tab has focus and you hit the Enter key.

This is working very nicely in general. However, it only works after the user has clicked at least once (anywhere in the DOM). When one loads the TabsPage the first time, if one navigates to a tab without using the mouse at all, the tabs do nothing when you hit Enter.

Programmatically activating tabs on a keydown event works, but what I really want is that the default keyboardinterface of the tabs works from the moment the page loads.

The problem occurs across browsers. I would highly appreciate any advice, a workaround, or a nice solution!


#2

I now found what causes this, it is this piece of code in node-modules > ionic-angular > tap-click > tap-click.js

TapClick.prototype.click = function (ev) {
    if (this.shouldCancelClick(ev)) {
        ev.preventDefault();
        ev.stopPropagation();
        return;
    }
    if (this.activator && this.plt.doc() !== ev.target) {
        // cool, a click is gonna happen, let's tell the activator
        // so the element can get the given "active" style
        var activatableEle = getActivatableTarget(ev.target);
        if (activatableEle) {
            this.activator.clickAction(ev, activatableEle, this.startCoord);
        }
    }
    (void 0) /* runInDev */;
 };
TapClick.prototype.shouldCancelClick = function (ev) {
    if (this.usePolyfill) {
        if (!ev.isIonicTap && this.isDisabledNativeClick()) {
            (void 0) /* console.debug */;
            return true;
       }
    }
    else if (!this.dispatchClick) {
        THIS IS WHERE IT GOES WRONG!
        (void 0) /* console.debug */;
        return true;
    }
    if (!this.app.isEnabled()) {
        (void 0) /* console.debug */;
        return true;
    }
    if (this.gestureCtrl.isCaptured()) {
        (void 0) /* console.debug */;
        return true;
    }
    return false;
};

It cancels keyboard events that should behave the same as clicks until a first click in the screen has occurred. Anyone/Ionic team, what can I do about this? I don’t want to make changes in this kind of file…!