Skip to content

Callout/Positioning: perf improvement with hidden flag and improved repositioning logic#4419

Merged
joschect merged 14 commits intomicrosoft:masterfrom
joschect:pref-improv
Apr 4, 2018
Merged

Callout/Positioning: perf improvement with hidden flag and improved repositioning logic#4419
joschect merged 14 commits intomicrosoft:masterfrom
joschect:pref-improv

Conversation

@joschect
Copy link
Copy Markdown
Contributor

@joschect joschect commented Mar 30, 2018

Pull request checklist

Description of changes

Note: This is a first round, comments are welcome

For when perf is a concern, isHidden can now be passed into the callout. If isHidden is true the callout will render, but it's content will not. When isHidden changes from true, to false, the callout will appear and render. This decreases the amount of layout thrashing and significantly reduces the amount of time it takes for the callout to appear. It does, however, increase the amount of dom complexity as the it's layer will be present. isHidden should be used sparingly and only when perf is a real concern.

Focus areas to test

Callout, contextualmenu

*/
getStyles?: IStyleFunction<ICalloutContentStyleProps, ICalloutContentStyles>;
/**
* Whether or not the callout should be hidden rather than displayed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better text:

If specified, renders the Callout in a hidden state. Use this flag, rather than rendering a callout conditionally based on visibility, to improve rendering performance when it becomes visible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

also blank line between props

if (this.props.setInitialFocus && !this._didSetInitialFocus && this.state.positions && this._calloutElement.value) {
this._didSetInitialFocus = true;
focusFirstChild(this._calloutElement.value);
this._async.requestAnimationFrame(() => focusFirstChild(this._calloutElement.value!));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is a new helper focusAsync, which does this. I wonder if focusFirstChild should just call focusAsync.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That would make a lot of sense, especially since focus triggers reflows.

@joschect joschect merged commit 15c098d into microsoft:master Apr 4, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Callout slow performance

2 participants