Opened 5 years ago

Closed 4 years ago

#18573 closed defect (invalid)

_KeyNavContainer endless loop when focused item becomes disabled and the user presses a key.

Reported by: MarkFalconbridge Owned by: MarkFalconbridge
Priority: undecided Milestone: tbd
Component: Dijit Version: 1.10.4
Keywords: Cc:
Blocked By: Blocking:

Description

  1. Create a dijit.toolbar with some buttons in it.
  2. Make the onClick action of the button disable itself.
  3. Click the button.
  4. Press a key on the keyboard.

At this point the code in _KeyNavContainer enters an endless loop looking for something that matches the key pressed but never gets out of the loop because the currently focused item is no longer focusable.

Attachments (1)

keynav.html (1.2 KB) - added by bill 4 years ago.
copy of jsfiddle test case

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by bill

Component: GeneralDijit
Owner: set to MarkFalconbridge
Status: newpending

OK. Can you attach a test case instead of just describing one?

comment:2 Changed 5 years ago by MarkFalconbridge

Status: pendingnew
<div id="widget"></div>

require(
    [
        "dojo/_base/declare",
        "dijit/layout/LayoutContainer",
        "dijit/Toolbar",
        "dijit/form/Button",
        "dojo/_base/array"
    ],
    function (declare, Container, Toolbar, Button, array) {
        var MyWidget = declare(Container, {
            postCreate: function () {
                this.inherited(arguments);

                var me = this;
                this.toolbar = new Toolbar({region: "top"});
                array.forEach(["1", "2", "3"], function (label) {
                    var button = new Button({
                        label: label,
                        showLabel: true,
                        onClick: function () {button.set('disabled', true)}
                    },label);

                    me.toolbar.addChild(button);
                });

                this.addChild(this.toolbar);
            },
            startup: function() {
                this.inherited(arguments);
                this.resize();
            }
        });
        
        var widget = new MyWidget({}, "widget");
    });
Last edited 5 years ago by bill (previous) (diff)

comment:3 Changed 5 years ago by MarkFalconbridge

Here's a jsfiddle. https://jsfiddle.net/kshdyqqy/ Run it, click one of the buttons and then press a few keys on the keyboard. You'll enter the endless loop.

comment:4 Changed 5 years ago by bill

OK, thanks for the test case(s).

comment:5 Changed 5 years ago by bill

Owner: changed from MarkFalconbridge to bill
Status: newassigned

Changed 4 years ago by bill

Attachment: keynav.html added

copy of jsfiddle test case

comment:6 Changed 4 years ago by bill

Owner: changed from bill to MarkFalconbridge
Status: assignedpending

It sounds like the problem you are describing was fixed by cef0a828574cc9f9f80f8bce0a46b7f293630232 but actually, I can't reproduce the error using your jsfiddle, even against 1.10.4 rather than master.

Your description to "press a few keys" is rather vague, but I'm guessing you are talking about typing "1", "2", or "3" rather than pressing the left and right arrow keys. In any case, both of those things are working for me in 1.10.4.

If you have more specific instructions to reproduce the problem, let me know. Also, let me know if it was fixed by cef0a828574cc9f9f80f8bce0a46b7f293630232.

PS: I was trying on Chrome/mac.

Last edited 4 years ago by bill (previous) (diff)

comment:7 Changed 4 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.