Javascript Widget losing focus for some reason

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Archgeek
Posts: 264
Joined: Wed May 02, 2007 6:00 am UTC
Location: Central US
Contact:

Javascript Widget losing focus for some reason

Postby Archgeek » Mon Jul 07, 2014 4:46 pm UTC

So I've been extending, hacking, and otherwise screwing with this accessible datepicker, doing stuff like extending the keyboard navigation to the months and years views, and altering the keyboard behaviour to act like the win7 calendar (notably enamoured of ^up/^down for moving between views) all of which has worked dandy. I've also ripped out the animation support stuff out of the main Picker.js class (just the slider object and the old/newContents objects, injecting directly to the column body element), which also works correctly, but only for the most part. A downright odd bug has developed in that the thing now loses focus when keyboard navigating from the days view, and only when doing that.

The following code makes the container that's currently visible oscillate between the two, seemingly so it can avoid emptying the active one, and then just swap them after updating in the background. However, that does not explain why I only get deleterious effects from just one transition upon removing them and doing this.body.adopt(this.columns) instead (specifically any transition from the days view, regardless of starting view or if years view is made adjacent instead of months).

Code: Select all

//swap contents so we can fill the newContents again and animate
var old = this.oldContents;
this.oldContents = this.newContents;
this.newContents = old;
this.newContents.empty();
this.newContents.adopt(this.columns);
this.oldContents.setStyles({left: 0, opacity: 0});
this.newContents.setStyles({left: 0, opacity: 1});

I've tested a number of possibilities, including the specific context change, days' status as the starting view, tabindex, months and years not having headers and missing aria is-selected properties, but all to no avail. What thoughts have ye good folk upon the matter?
"That big tube down the side was officially called a "systems tunnel", which is aerospace contractor speak for "big tube down the side."

User avatar
Archgeek
Posts: 264
Joined: Wed May 02, 2007 6:00 am UTC
Location: Central US
Contact:

Re: Javascript Widget losing focus for some reason

Postby Archgeek » Mon Jul 14, 2014 5:20 pm UTC

Hmm. I see my question may've been a bit scattershot. After a lot of analysis and solving a related problem such that the content buffer divisions (what I'm now calling old/newContents) don't need to be removed anymore, perhaps I can ask a more clear-cut query--though I can see the problem with calling empty() on an element that contains another element that has focus, why might doing this result in loss of focus when transitioning from displaying one specific table layout, but not another?
"That big tube down the side was officially called a "systems tunnel", which is aerospace contractor speak for "big tube down the side."


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 12 guests