Stephen Waterbury
unread,Mar 7, 2014, 1:46:01 PM3/7/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pyjs-...@googlegroups.com
I was recently astonished to discover that the Label widget gets
a 'div' element, not a 'label' element. This bit me while doing
accessibility testing for my app -- screen readers expect all
form fields, inputs etc. to have labels. I was using Label
widgets for that, so I was puzzled when accessibility tools like
the Firefox "WAVE" plugin did not find the labels ... then I
noticed that the Label widgets all had <div> elements, not
<label> elements -- arg.
So my next move was to hack the Label.py code, changing its
DOM.createDiv() to DOM.createLabel(). That fixed the labels but
caused a whole slew of other messages ... hmm, turns out that the
HTML widget inherits from the Label widget ... wtf?? I guess
there must be some weird, counter-intuitive historical reasons
(maybe GWT does that?). So not wanting to do *too* much hacking,
I replaced all my app's HTML widgets with HTMLPanel widgets
(which do *not* inherit from Label), which makes them heavier
than they need to be (they don't really need to be Panels).
If anyone cares and understands what the consequences would be
(e.g. other breakage), I'd suggest switching the positions of
Label and HTML in the pyjamas.ui widget tree -- shouldn't Label
be *more* specific than HTML? (And let HTML inherit from
MouseHandler and ClickHandler, as Label currently does.)
Steve