As I was testing my upcoming release of Panel View for Keep, I came across a strange bug.

I was trying to drag a Keep’s tab to the end of my (not unsubstantial) tab list, and I accidentally detached the tab into its own window. Thinking nothing of it, I dragged it back and reattached it to its original window. Then I opened Keep’s menu and clicked “Send to Panel.”

The panel opened up to Keep, all right, but the tab also stayed open. That’s weird, I thought. I restarted the extension and duplicated the scenario, detaching then reattaching a tab pointed to Keep. When the exact same thing happened, I realized I had encountered a bug.

Since I was already working on a release, I thought it made sense to wrap up a fix to this particular bug in as well.

I have a number of event listeners defined in Panel View for Keep, in order to keep track of how Keep is opened. It can exist in a tab, which has both a window ID and a tab ID. It can also exist in a panel (which is really the point of the extension anyway), which has a window ID but no tab ID. (I’m still not certain if this is bug or not; there is much discussion in the Chromium project on panels and their use outside Chrome OS.)

At any rate, while I have event listeners defined for the creation and removal of tabs and windows, I did not take into account the tab attachment and detachment events. Now that I’ve put the proper handlers in place for those two events, the extension properly closes the reattached tab when moving to a panel.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.