Fix help page not closing from keybind

This commit is contained in:
Ajay 2022-06-09 14:02:23 -04:00
parent 32a3cb2cfe
commit 25c04a49c1
4 changed files with 7 additions and 6 deletions

View file

@ -163,7 +163,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
this.guidelinesReminder?.close();
this.noticeRef.current.close(true);
this.contentContainer().resetSponsorSubmissionNotice();
this.contentContainer().resetSponsorSubmissionNotice(false);
this.props.closeListener();
}

View file

@ -1878,8 +1878,8 @@ function dontShowNoticeAgain() {
/**
* Helper method for the submission notice to clear itself when it closes
*/
function resetSponsorSubmissionNotice() {
submissionNotice?.close();
function resetSponsorSubmissionNotice(callRef = true) {
submissionNotice?.close(callRef);
submissionNotice = null;
}

View file

@ -35,7 +35,7 @@ class SubmissionNotice {
contentContainer={contentContainer}
callback={callback}
ref={this.noticeRef}
closeListener={() => this.close()} />,
closeListener={() => this.close(false)} />,
this.noticeElement
);
}
@ -44,7 +44,8 @@ class SubmissionNotice {
this.noticeRef.current.forceUpdate();
}
close(): void {
close(callRef = true): void {
if (callRef) this.noticeRef.current.cancel();
ReactDOM.unmountComponentAtNode(this.noticeElement);
this.noticeElement.remove();

View file

@ -16,7 +16,7 @@ export interface ContentContainer {
updatePreviewBar: () => void,
onMobileYouTube: boolean,
sponsorSubmissionNotice: SubmissionNotice,
resetSponsorSubmissionNotice: () => void,
resetSponsorSubmissionNotice: (callRef?: boolean) => void,
updateEditButtonsOnPlayer: () => void,
previewTime: (time: number, unpause?: boolean) => void,
videoInfo: VideoInfo,