Bug 1967813 - Check menu's frame IsOpen to determine if menu is active. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D250492
This commit is contained in:
Eitan Isaacson
2025-05-23 17:17:53 +00:00
committed by eisaacson@mozilla.com
parent b713535f47
commit 047d7acfa2
2 changed files with 10 additions and 1 deletions

View File

@@ -15,6 +15,8 @@
src="../events.js" />
<script type="application/javascript"
src="../role.js" />
<script type="application/javascript"
src="../states.js" />
<script type="application/javascript">
<![CDATA[
@@ -33,6 +35,7 @@
this.finalCheck = function openMenu_finalCheck()
{
testStates(aID, STATE_FLOATING, 0, STATE_INVISIBLE | STATE_OFFSCREEN | STATE_COLLAPSED);
testAccessibleTree(aID, aTree);
}
@@ -113,6 +116,11 @@
{
return "close menu " + prettyName(aID);
}
this.finalCheck = function closeMenu_finalCheck()
{
testStates(aID, STATE_FLOATING | STATE_INVISIBLE | STATE_OFFSCREEN | STATE_COLLAPSED, 0);
}
}
//gA11yEventDumpToConsole = true;

View File

@@ -339,7 +339,8 @@ uint64_t XULMenupopupAccessible::NativeState() const {
#ifdef DEBUG
// We are onscreen if our parent is active
bool isActive = mContent->AsElement()->HasAttr(nsGkAtoms::menuactive);
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
bool isActive = menuPopupFrame ? menuPopupFrame->IsOpen() : false;
if (!isActive) {
LocalAccessible* parent = LocalParent();
if (parent) {