Crazy JavaScript error with smaller ribbons

So I had a really scary JavaScript error the other day when I tried to open the ribbon in a narrow browser window. I was testing scaling on some other components and happened to glance at the console only to see this:

At the same time the entire tab in the ribbon went completely blank.

Blank Files ribbon tab

After digging around a bit (I can post my debug steps if anyone’s interested) it turned out that the reason for the gigantic error simply was that one of my custom ribbon buttons was missing an Image16by16 attribute. This attribute describes which image to use as an icon for the button when there is not enough room in the ribbon to display the full size icon (from the attribute Image32by32).

Lesson learned. Always include both attributes as well as positioning if using a sprite image. Oddly enough the attributes are all described as “Optional” in the spec though…

Leave a Reply

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