Neil's Place

Archive for July, 2007

Menu and Popups Guide

Thursday, July 26th, 2007

The Menu and Popups Guide is now available which provides detailed documentation on the XUL menu, context menu, panel and tooltip features as well as how to use them from script. Additional improvements are much appreciated, for instance more examples or images.

In other XUL popup news, I’ve been fixing a few regressions lately, as well as fixing some other long standing popup bugs. For Mozilla 1.9, we can look forward to being able to put decks and trees in a popup panel and have them actually work. I’ve also got a fix in hand for focus navigation in popups, so one can press Tab and cycle between elements without navigating outside the popup unexpectedly. Also, focus doesn’t get confused when a popup opens or closes.

XUL Popup Improvements

Thursday, July 5th, 2007

The popup reworking patch finally made it in yesterday without any performance regressions. This features a number of improvements to the popup code.

  • Popups now open as well as fire events and change attributes asynchronously in some cases, making popups less crash prone.
  • Popups are kept track of better, avoiding the popups that hang on the screen and cannot be closed issue.
  • Some reflow improvements which make popups not jump about on the screen. Also, hopefully, the size of a popup or tooltip is determined properly, or at least more likely to be accurate.
  • Some decomtamination and removal of much duplicated code.
  • An openPopup and openPopupAtScreen method to use instead of the confusing showPopup. (showPopup is still supported though). The former opens a popup relative to another node while the latter opens a popup at a specific screen position.
  • A <panel> element is added which is designed for popups that are not menus. XUL didn’t offically support this before. <menupopup> should be used for menus and <tooltip> for tooltips. The <popup> element is deprecated (as has always been the case) and is equivalent to <menupopup>.

There’s still some work to be done with popups. For instance, focus navigation in popups is a bit broken. This could be a tricky fix as it requires fixing some focus code while avoiding becoming the focus module owner.

Testing of popups is much appreciated. I know about the tooltips in html being the wrong size issue. The fix for this is to remove a workaround so that’s a good thing.