Skip to content
Permalink
Browse files

Fix reporting of "not checked" for check boxes with no other states i…

…n browse mode. (#10781)

When determining whether the caller wants states, we must differentiate between None and the empty set.
If the caller didn't want states, states will be None.
However, empty states means the caller still wants states, but the object had no states; e.g. an unchecked check box with no other states.
Previously, we treated an empty set as if the caller didn't want states.
  • Loading branch information
jcsteh committed Feb 12, 2020
1 parent 701f490 commit 39274e5b1a58708eadbafe8b85096c9ede0e1838
Showing with 9 additions and 3 deletions.
  1. +1 −1 source/braille.py
  2. +8 −2 source/speech/__init__.py
@@ -519,7 +519,7 @@ def getPropertiesBraille(**propertyValues) -> str: # noqa: C901
value = propertyValues.get("value")
if value and role not in controlTypes.silentValuesForRoles:
textList.append(value)
if states:
if states is not None:
textList.extend(
controlTypes.processAndLabelStates(role, states, controlTypes.REASON_FOCUS, states, None, positiveStateLabels, negativeStateLabels)
)
@@ -1499,10 +1499,16 @@ def getPropertiesSpeech( # noqa: C901
textList.append(roleText if roleText else controlTypes.roleLabels[role])
if value:
textList.append(value)
states=propertyValues.get('states',set())
states = propertyValues.get('states')
realStates=propertyValues.get('_states',states)
negativeStates=propertyValues.get('negativeStates',set())
if states or negativeStates:
# If the caller didn't want states, states will be None.
# However, empty states means the caller still wants states, but the object
# had no states; e.g. an unchecked check box with no other states.
if states is not None or negativeStates:
if states is None:
# processAndLabelStates won't accept None for states.
states = set()
labelStates = controlTypes.processAndLabelStates(role, realStates, reason, states, negativeStates)
textList.extend(labelStates)
# sometimes description key is present but value is None

0 comments on commit 39274e5

Please sign in to comment.
You can’t perform that action at this time.