Closed Bug 1521438 Opened 5 years ago Closed 5 years ago

IAccessible::get_accSelection should return VT_EMPTY if no selected items

Categories

(Core :: Disability Access APIs, enhancement, P2)

All
Windows
enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

Details

Attachments

(1 file)

Test case:
data:text/html,<div role="listbox"><div role="option">a</div><div role="option">b</div></div>
Calling IAccessible::get_accSelection on the list box returns VT_UNKNOWN and an IUnknown (which can be queried to IEnumVARIANT). Calling Next on the IEnumVARIANT then returns no items. This is incorrect according to the docs for get_accSelection:
https://docs.microsoft.com/en-us/windows/desktop/api/oleacc/nf-oleacc-iaccessible-get_accselection
They state that VT_UNKNOWN should be returned if "Multiple child objects are selected" and that VT_EMPTY should be returned if "No children are selected". I could accept VT_UNKNOWN for a single child (even though this should be VT_DISPATCH strictly speaking), but returning an empty IEnumVARIANT is just weird.

This is making things difficult for NVDA's in-progress support for rendering the selected item in list boxes/trees in browse mode with Firefox.

Previously, we were always returning VT_UNKNOWN and an IEnumVARIANT.
According to the IAccessible documentation, this should only be done for multiple selection.
Change this to correctly return VT_EMPTY for no selection and VT_DISPATCH (with an accessible) for single selection.

Test cases confirmed working with this patch:

No selection (should return VT_EMPTY):
data:text/html,<div role="listbox"><div role="option">a</div><div role="option">b</div></div>

Single selection (should return VT_DISPATCH for "b"):
data:text/html,<div role="listbox"><div role="option">a</div><div role="option" aria-selected="true">b</div></div>

Multiple selection (should return VT_UNKNOWN and an IEnumVARIANT with both "a" and "b"):
data:text/html,<div role="listbox"><div role="option" aria-selected="true">a</div><div role="option" aria-selected="true">b</div></div>

Pushed by mzehe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/311d09aeb1ab
Correct IAccessible::get_accSelection implementation for no selection and single selection. r=MarcoZ
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: