-
Notifications
You must be signed in to change notification settings - Fork 47
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
fix(reply): Fix at mention list misaligned after window resize #678
Conversation
mxiao6
commented
Jan 28, 2021
- unit test
- cross-browser testing
@@ -58,6 +58,10 @@ export default class ReplyField extends React.Component<Props, State> { | |||
fetchCollaborators(trimmedQuery); | |||
}, DEFAULT_COLLAB_DEBOUNCE); | |||
|
|||
componentDidMount(): void { | |||
window.addEventListener('resize', this.updatePopupReference); |
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.
Should this be debounced? Does this conflict with preview's resize handling at all?
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 debounce is needed here since we don't need to catch the new dimensions. We just trigger a popper update, it shouldn't conflict with preview's resize handling.
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.
Hm, it looks like calling this.updatePopupReference
triggers a setState
and also a bunch of logic to get data from the DOM via getVirtualElement
. How can we come to further certainty regarding "shouldn't" on the above?
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.
One possible conflict that might crop up could be caused by the Preview SDK's own debounced resize handler. Is it possible that the following re-render in the Preview SDK could occur after the resize handler in Annotations? Would that cause the popup to be mispositioned? There may be other examples, such as resize handlers in BUIE.
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.
db59dcb
to
6b432bf
Compare
6b432bf
to
9363b6e
Compare