[Zope3-dev] menu item ordering

Guido van Rossum guido@python.org
Thu, 24 Apr 2003 11:53:35 -0400


> > I think there's a default ordering which goes from most specific to
> > least specific.  This is useful (we hope) for e.g. the "tabs" where
> > the tabs specific to the object type at hand are on the left and
> > generic tabs that apply to all objects on the right.  E.g. when
> > viewing ++etc++site, the "Services" tab (which applies only here) is
> > on the left, and the "Introspector" tab (which applies to *all*
> > objects AFAICT) is on the far right.  In between are tabs of medium
> > applicability. 
> 
> It does look this way -- I guess this was in the back of my mind, as I'd
> tend to look on the left for the new stuff.
> 
> Just to throw out an idea, might it be better to do the opposite -- add
> new tabs to the right instead of the left? As an arrogant westerner, of
> course, I know everyone reads from left to right :-o which would tend to
> make the tabs more "stable" (consistent?) for users.

I don't think so -- the most important (== relevant) tabs would run
the risk of running off the screen if your browser window is too
narrow to contain them all.

In this situation I don't think that L2R reading order has much to do
with user accustomization; either way it's spatial rearrangement that
matters.

> >> - Can the order of these items be precisely controlled?
> > 
> > For the "Add service" menu I managed to get them in alphabetically
> > sorted order.  This is done in
> > zope/app/browser/container/adding.py, class Adding, method
> > addingInfo().  I suppose each of the menus has some associated
> > Python code that is used to generate the menu items, and this code
> > could sort them by whatever key is useful.
> 
> Aren't most menus defined in ZCML? Would it be useful to add a menu
> sort directive to give developers control over this? I realize this
> opens up a bit of complexity, but I can see this becoming an
> important issue for UI folks.

I dunno.  Given that specifying the sort may be tricky (look at the
comparison function in addingInfo()) it's probably better expressed as
Python code than in ZCML.

--Guido van Rossum (home page: http://www.python.org/~guido/)