Panel View for Keep 2.3

I just updated this thing yesterday! Why is there another change? Read on, Internet citizen, read on. First, a little history When I rewrote the extension for version 2, I attempted to streamline its behavior. The first version expected you to choose how you wanted the extension to open Keep: in a tab, in a…

I just updated this thing yesterday! Why is there another change? Read on, Internet citizen, read on.

First, a little history

When I rewrote the extension for version 2, I attempted to streamline its behavior. The first version expected you to choose how you wanted the extension to open Keep: in a tab, in a popup window, or in a panel.

Yes, the extension is called “Panel View for Keep,” but the extension began life as a shortcut to the webapp. This was before Google released their webapp, you understand, so there was nothing officially available.

I had originally named the extension “Google Keep Extension” or something like that, which eventually got it banned from the Chrome Store. The updated rules state that if a product uses a Google service — of which Keep is, of course — the product’s name must have its own name first, followed by “for [Google service].” So I renamed the extension “Panel View for Keep” and petitioned for its reinstatement to the store.

So anyway, when I started working on version 2, I thought that making the user choose from a list was a little heavy-handed. I thought it made more sense to expose a link on the page that could transition from a tab to a panel (or a popup, if the user had not enabled panels). And that’s the way it’s been since; the UI has changed as Google has updated Keep’s webapp to utilize Material Design, but the functionality has remained the same.

The strange bug

I wrote for the 2.2 update that the extension now always opens Keep in a new tab, for each new browser session. That’s simple enough. If you have Keep open and you click the icon to open the extension again, it’s smart enough to switch to that tab instead of opening up a new tab every time. (This was a feature request, and it’s a bit of JavaScript that I’m pretty proud of. It’s also the reason the extension requires the “tab” permission.)

But it was brought to my attention that if you changed the url in that extension-opened tab — say, you clicked on a link that took you away, or even just entered a URL in the bar and hit enter — clicking on the extension’s icon would switch you to that tab, whether it was pointed at keep.google.com or not.

The reason for this is because the extension keeps track of the window and tab IDs when you click its icon. When you switch from a tab to a panel, it keeps track of the changing window IDs and the loss of the tab ID. When you switch from a panel back to a tab, it keeps track of the changing window IDs again and the new tab ID. But I never wrote any code to handle whether or not the existing tab ID was still pointed at Keep’s website.

After a little restructuring, it’s fixed now. The extension still retains the tab ID, but it now also validates the address as well. The update is live on the Chrome Store, and I’ve committed the update to the Github repo as well.


Hat tip to +ChristopherKing for bringing this bug to my attention.

Fork me on GitHub

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Related