-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Always use getDocument in FocusZone and FocusTrapZone #10187
Merged
JasonGore
merged 9 commits into
microsoft:master
from
sophieH29:sohuts/use-getdocument-in-focuszone
Aug 20, 2019
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1d853c2
Merge pull request #1 from OfficeDev/master
sophieH29 a4fd887
Merge pull request #2 from OfficeDev/master
sophieH29 3df47ad
merge upstream master
c4766bf
Use getDocument instead document in FocusZone and FocusTrapZone
e99a94f
Change files
7fd9dac
improvements after CR comments
36d9ad0
FTZ improvement
9f466ea
return document for SSR case
febceb0
check document for SSR case
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
change/office-ui-fabric-react-2019-08-19-17-03-13-sohuts-use-getdocument-in-focuszone.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Use getDocument instead document in FocusZone and FocusTrapZone", | ||
"packageName": "office-ui-fabric-react", | ||
"email": "sohuts@microsoft.com", | ||
"commit": "c4766bf28c3c6fe6021e2a0f277524bcc64064b4", | ||
"date": "2019-08-19T15:03:13.879Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 think there are enough uses here that it's worthwhile to make a little helper function and call it directly while eliminating the need for intermediate local
doc
variables. Something like: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.
Agree. But still, make sense to remain in places were
doc
variable is used multiple times within a function scopeThere 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.
@JasonGore addressed
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.
Aren't there more replaceable instances above? I only see once case where it's actually used more than once.
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 replaced all
document.*
usage with_getDocument().*
.In 2 places inFocusZone
and and 1 place inFocusTrapZone
I saved it to variableconst doc = this._getDocument();
and used asdoc.*
because it is used more than once within the function scope. Let me know if it does make sense