Skip to content

Commit

Permalink
Fix reporting of "not checked" for check boxes with no other states i…
Browse files Browse the repository at this point in the history
…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 39274e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/braille.py
Expand Up @@ -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)
)
Expand Down
10 changes: 8 additions & 2 deletions source/speech/__init__.py
Expand Up @@ -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
Expand Down

0 comments on commit 39274e5

Please sign in to comment.