зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1480058 part 1: Expose states for aria-selected/aria-multiselectable on XUL tab/tabs. r=surkov
MozReview-Commit-ID: JeV5vBffQIq --HG-- extra : rebase_source : 3e6979e1e1995e62951250937d0c28f1128dcbac
This commit is contained in:
Родитель
e3cf7e35dd
Коммит
6647aa6cc0
|
@ -24,6 +24,14 @@
|
|||
testStates("pressed_button", STATE_PRESSED, 0, STATE_CHECKABLE);
|
||||
testStates("pressed_menu_button", STATE_PRESSED | STATE_HASPOPUP, 0, STATE_CHECKABLE);
|
||||
|
||||
testStates("tabs", STATE_MULTISELECTABLE);
|
||||
// Make sure XUL selection works, since aria-selected defaults to false.
|
||||
testStates("tab1", STATE_SELECTED);
|
||||
// aria-selected="true".
|
||||
testStates("tab2", STATE_SELECTED);
|
||||
// Neither.
|
||||
testStates("tab3", 0, 0, STATE_SELECTED);
|
||||
|
||||
SimpleTest.finish()
|
||||
}
|
||||
|
||||
|
@ -53,6 +61,14 @@
|
|||
<menuitem label="I am a menu item" />
|
||||
</menupopup>
|
||||
</button>
|
||||
|
||||
<tabbox>
|
||||
<tabs id="tabs" aria-multiselectable="true">
|
||||
<tab id="tab1" label="tab1" selected="true"/>
|
||||
<tab id="tab2" label="tab2" aria-selected="true"/>
|
||||
<tab id="tab3" label="tab3"/>
|
||||
</tabs>
|
||||
</tabbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "XULTabAccessible.h"
|
||||
|
||||
#include "ARIAMap.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
|
@ -123,6 +124,17 @@ XULTabAccessible::RelationByType(RelationType aType) const
|
|||
return rel;
|
||||
}
|
||||
|
||||
void
|
||||
XULTabAccessible::ApplyARIAState(uint64_t* aState) const
|
||||
{
|
||||
HyperTextAccessibleWrap::ApplyARIAState(aState);
|
||||
// XUL tab has an implicit ARIA role of tab, so support aria-selected.
|
||||
// Don't use aria::MapToState because that will set the SELECTABLE state
|
||||
// even if the tab is disabled.
|
||||
if (nsAccUtils::IsARIASelected(this)) {
|
||||
*aState |= states::SELECTED;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTabsAccessible
|
||||
|
@ -159,6 +171,16 @@ XULTabsAccessible::NativeName(nsString& aName) const
|
|||
return eNameOK;
|
||||
}
|
||||
|
||||
void
|
||||
XULTabsAccessible::ApplyARIAState(uint64_t* aState) const
|
||||
{
|
||||
XULSelectControlAccessible::ApplyARIAState(aState);
|
||||
// XUL tabs has an implicit ARIA role of tablist, so support
|
||||
// aria-multiselectable.
|
||||
MOZ_ASSERT(Elm());
|
||||
aria::MapToState(aria::eARIAMultiSelectable, Elm(), aState);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTabpanelsAccessible
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
virtual uint64_t NativeState() const override;
|
||||
virtual uint64_t NativeInteractiveState() const override;
|
||||
virtual Relation RelationByType(RelationType aType) const override;
|
||||
virtual void ApplyARIAState(uint64_t* aState) const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
|
@ -48,6 +49,7 @@ public:
|
|||
// Accessible
|
||||
virtual void Value(nsString& aValue) const override;
|
||||
virtual a11y::role NativeRole() const override;
|
||||
virtual void ApplyARIAState(uint64_t* aState) const override;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount() const override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче