Bug 1880199: Make XULTabAccessible check for the presence of the pinned attribute rather than the explicit value "true". r=ayeddi

In bug 1849904, the pinned attribute was changed to be a boolean attribute.
However, a11y was not updated accordingly and was still looking for the explicit value "true".
This meant that when pinned tabs were restored, their pinned state was not exposed to accessibility clients.
Fix this by checking for the presence of the pinned attribute instead, since presence means true and absence means false.

Differential Revision: https://phabricator.services.mozilla.com/D202372
This commit is contained in:
James Teh 2024-02-22 08:21:17 +00:00
parent 93c6e276e8
commit c5a441100c
2 changed files with 4 additions and 5 deletions

View file

@ -23,7 +23,7 @@
function doTest()
{
testStates("tab1", 0, EXT_STATE_PINNED);
testStates("tab2", 0, 0, 0, EXT_STATE_PINNED);
testStates("tab2", 0, EXT_STATE_PINNED);
testStates("tab3", 0, 0, 0, EXT_STATE_PINNED);
SimpleTest.finish()
@ -51,8 +51,8 @@
<vbox flex="1">
<tabbox>
<tabs id="tabs">
<tab id="tab1" label="tab1" pinned="true"/>
<tab id="tab2" label="tab2" pinned="false"/>
<tab id="tab1" label="tab1" pinned=""/>
<tab id="tab2" label="tab2" pinned="true"/>
<tab id="tab3" label="tab3"/>
</tabs>
<tabpanels id="tabpanels">

View file

@ -69,8 +69,7 @@ uint64_t XULTabAccessible::NativeState() const {
state |= states::SELECTED;
}
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::pinned,
nsGkAtoms::_true, eCaseMatters)) {
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::pinned)) {
state |= states::PINNED;
}
}