-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude MoreButton if Not using PrimaryCommands #6044
Conversation
@karenbtlai can you please add a test ? |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -907,8 +909,11 @@ void CommandBarFlyoutCommandBar::PopulateAccessibleControls() | |||
|
|||
if (auto const& moreButton = m_moreButton.get()) | |||
{ | |||
m_horizontallyAccessibleControls.Append(moreButton); | |||
m_verticallyAccessibleControls.Append(moreButton); | |||
if (primaryCommands.Size() > 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the primary commands size is reduced from 1 to 0? what about if its increased from 0 to 1? do we have the appropriate code in place to make sure that the more button is added or removed based on this? Can we add a test for these scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
var favoriteToggleElement = AutomationElement.FocusedElement; | ||
Verify.AreEqual(favoriteToggleElement.Current.AutomationId, favoriteToggleButton6.AutomationId); | ||
|
||
Log.Comment("Press Down key to make sure commands loops back focus to first secondary command: Redo."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this test faster by simply pressing the up key from the first element and making sure it goes to the last and not the more button?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
|
||
[TestMethod] | ||
public void VerifyAddRemovePrimaryCommands() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't test the removal of a primary command, only the addition of one.
More importantly, I wouldn't expect the behavior to fail when you change the number of commands in the CBF while it is closed. The bug I called out in the product code would only happen if you change the number of commands while the flyout is open.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a scenario where the number of commands will change while the flyout is open, since CBF is a flyout and transient by design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline. Test case is updated to be adding PrimaryCommands dynamically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness removing the last primary command could also be tested. It uses what looks like the same code path though so maybe it is fine.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure that the WidthExpansionDelta change makes sense.
|
||
[TestMethod] | ||
public void VerifyAddRemovePrimaryCommands() | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For completeness removing the last primary command could also be tested. It uses what looks like the same code path though so maybe it is fine.
@@ -678,7 +678,7 @@ void CommandBarFlyoutCommandBar::UpdateTemplateSettings() | |||
collapsedWidth = static_cast<float>(expandedWidth); | |||
} | |||
|
|||
flyoutTemplateSettings->WidthExpansionDelta(collapsedWidth - expandedWidth); | |||
flyoutTemplateSettings->WidthExpansionDelta(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change, but if @llongley or someone else does that is good enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought there was a need for a nonzero value for this, but Karen said that she tested all of the scenarios and they all continue to look right, so if that's the case it seems OK to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When PrimaryCommands are being loaded dynamically, it causes a weird crop issue that is caused by a negative WidthExpansionDelta
. Setting it to 0 fixes this specific use case. Upon investigation, it seems a non-zero WidthExpansionDelta
is only for when SecondaryCommands is collapsed, and the width of primaryCommands is less than the width of SecondaryCommands, so the flyout expands to the full width when opening the secondaryCommands.
However, setting it to 0 doesn't seem to break that scenario. This may be because CBF no longer has the expanding animation. I manually all scenarios with and without the WidthExpansionDelta
change, and it doesn't change or break anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CBF does have the expanding animation still though, there is a button for it on the CommandBarFlyout test page labeled "Show expanding CommandBarFlyout"
This is the behavior before this change:
PreChange.mp4
and this is the behavior after the change
PostChange.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I now see a subtle expanding animation that is missing from the update. I think the appropriate action is to revert the hardcoding of ExpansionWidthDelta, and fix the dynamically adding primary buttons in a separate fix. It is beyond the scope of the original accessibility bug to begin with.
Description
If no PrimaryCommands is present, the SeeMore button is still visible and focusable, causing keyboard accessibility issues.
The fix is to check if
PrimaryCommands().Size() > 0
atPopulateAccessibleControls()
onPrimaryCommands().VectorChanged()
. If size is 0, the SeeMore button is excluded from being populated in the horizontally and vertically accessible controls member variable, and is no longer accessible.Motivation and Context
Fixes #5857 and internal bug 35345814
How Has This Been Tested?