Skip to content

FocusZone: reset alignment when receiving focus for first time#8439

Merged
dzearing merged 5 commits intomicrosoft:masterfrom
dzearing:focuszone-align
Mar 22, 2019
Merged

FocusZone: reset alignment when receiving focus for first time#8439
dzearing merged 5 commits intomicrosoft:masterfrom
dzearing:focuszone-align

Conversation

@dzearing
Copy link
Member

@dzearing dzearing commented Mar 22, 2019

Pull request checklist

Description of changes

Now DatePicker and other scenarios using bidirectional FocusZones will reset focus alignment when receiving focus for the first time.

Microsoft Reviewers: Open in CodeFlow

@KevinTCoughlin
Copy link
Member

@dzearing, snapshots need to be updated

top: 0,
bottom: 20,
left: 0,
right: 30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, is this actually meant to overlap with Button B? (Button B's left is 20.)

if (isImmediateDescendant) {
this._setFocusAlignment(this._activeElement);
if (isImmediateDescendant || !this._activeElement) {
this._setFocusAlignment(newActiveElement, true, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure about defaultActiveElement. I see in constructor that if defaultActiveElement prop is present, then _activeElement will be set in constructor. As a result, this code wouldn't be triggered. Is that intended when defaultActiveElement is used?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I do see _activeElement set to null in a couple of places in this module. Wanted to make sure that it won't falsely trigger this code or cause issues...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it will fix defaultActiveElement. Talked in person. We will not address that here and keep this scoped to the manual focus scenario.

@size-auditor
Copy link

size-auditor bot commented Mar 22, 2019

Bundle test Size (minified) Diff from master
CommandBar 180.218 kB ExceedsBaseline     41 bytes
SelectedItemsList 204.459 kB ExceedsBaseline     41 bytes
Panel 178.15 kB ExceedsBaseline     41 bytes
Nav 169.794 kB ExceedsBaseline     41 bytes
Dialog 179.606 kB ExceedsBaseline     41 bytes
DetailsList 208.957 kB ExceedsBaseline     41 bytes
Pickers 253.183 kB ExceedsBaseline     41 bytes
Pivot 168.336 kB ExceedsBaseline     41 bytes
DatePicker 199.266 kB ExceedsBaseline     41 bytes
ContextualMenu 144.331 kB ExceedsBaseline     41 bytes
Dropdown 205.486 kB ExceedsBaseline     41 bytes
Rating 82.242 kB ExceedsBaseline     41 bytes
ComboBox 217.777 kB ExceedsBaseline     41 bytes
MessageBar 170.061 kB ExceedsBaseline     41 bytes
SearchBox 167.105 kB ExceedsBaseline     41 bytes
ExtendedPicker 85.269 kB ExceedsBaseline     41 bytes
DocumentCard 192.091 kB ExceedsBaseline     41 bytes
OverflowSet 55.282 kB ExceedsBaseline     41 bytes
Facepile 188.566 kB ExceedsBaseline     41 bytes
ShimmeredDetailsList 219.781 kB ExceedsBaseline     41 bytes
FloatingPicker 214.937 kB ExceedsBaseline     41 bytes
SpinButton 173.39 kB ExceedsBaseline     41 bytes
FocusZone 28.949 kB ExceedsBaseline     41 bytes
Calendar 143.548 kB ExceedsBaseline     41 bytes
SwatchColorPicker 176.387 kB ExceedsBaseline     41 bytes
TeachingBubble 174.816 kB ExceedsBaseline     41 bytes
Button 172.422 kB ExceedsBaseline     41 bytes
Breadcrumb 178.691 kB ExceedsBaseline     41 bytes
Grid 163.458 kB ExceedsBaseline     41 bytes
GroupedList 118.879 kB ExceedsBaseline     41 bytes

ExceedsTolerance  Exceeds Tolerance     ExceedsBaseline  Exceeds Baseline     BelowBaseline  Below Baseline     1 kB = 1000 bytes

@dzearing dzearing merged commit 6fc1ee4 into microsoft:master Mar 22, 2019
@dzearing dzearing deleted the focuszone-align branch March 22, 2019 23:13
@msft-github-bot
Copy link
Contributor

🎉office-ui-fabric-react@v6.160.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FocusZone] onFocus handler does not update focus alignment

4 participants