| Description: |
::tk::accessible::_init begins with
if {[catch {::tk::accessible::get_acc_role $w} msg]} {
if {$msg == $role} {
return
}
}
which returns only when get_acc_role fails and its error message equals
the role, that is never, although the comment above it says the defaults
are set only once. So _init runs on every <Map> and resets role, name,
description, value, state and action to the class defaults. That
overwrites what the application set with ::tk::accessible::set_acc_*, both
before the widget is first mapped and after any re-map (pack forget + pack,
switching notebook tabs, a withdrawn toplevel shown again). This is on all
platforms; the output below is from X11.
"repro.tcl -names" on stock 9.1.0 (a screen reader, or any process named
"orca", must be running so that Tk loads accessibility.tcl):
before map: name=Open file / description=Open file
after map: name=Button / description=Open
after re-map: name=Button / description=Open
Simply returning when a role is already set would break Tk's own
refreshes, which rely on _init running again: the TNotebook
<<NotebookTabChanged>> binding updates the notebook's value to the current
tab through _init, and a re-map refreshes a widget's text.
Proposed fix (04.patch): _init remembers the values it set itself, per
widget (cleared on <Destroy>), and overwrites an attribute only when it is
unset or still holds the value that _init set last time. With it:
before map: name=Open file / description=Open file
after map: name=Open file / description=Open file
after re-map: name=Open file / description=Open file
notebook value: General
notebook value after selecting tab 2: Advanced
(The notebook lines are the same as without the patch.)
|