Fix mouse handler binding for talking book tool (BL-16366)#8000
Fix mouse handler binding for talking book tool (BL-16366)#8000StephenMcConnel wants to merge 1 commit into
Conversation
|
| Filename | Overview |
|---|---|
| src/BloomBrowserUI/bookEdit/toolbox/talkingBook/audioRecording.ts | Refactors button event handlers from direct DOM binding to document-delegated namespaced events so they survive toolbox re-hydration; converts audioLevelListener/micErrorListener to arrow-function class fields; adds wiredPlayer tracking to re-attach media events after #player replacement. |
| src/BloomBrowserUI/utils/WebSocketManager.ts | Adds a null-guard in removeListener so it returns early when the clientContext callbacks array has already been deleted by closeSocket, preventing a crash on first addAudioLevelListener/addMicErrorListener call. |
Reviews (5): Last reviewed commit: "Fix mouse handler binding for talking bo..." | Re-trigger Greptile
dd9237c to
28135c3
Compare
JohnThomson
left a comment
There was a problem hiding this comment.
@JohnThomson reviewed 1 file and all commit messages, and made 1 comment.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on StephenMcConnel).
src/BloomBrowserUI/bookEdit/toolbox/talkingBook/audioRecording.ts line 250 at r2 (raw file):
.on("click" + ns, "#audio-next", () => this.moveToNextAudioElement(), );
If I'm understanding right, since these are attached to the document, all clicks in any toolbox will activate all of them...then a filter will determine that the event didn't originate with the right element and ignore it. I don't suppose it matters very much, but I wonder if we should try to clean up when TB closes?
Of course then we have to reinstate them when it opens...and that's probably after the new buttons get created, so we could just attach them to the buttons, if we do it then (if I'm understanding the problem).
We could also just merge as-is. But it seemed worth asking.
28135c3 to
6504c1f
Compare
StephenMcConnel
left a comment
There was a problem hiding this comment.
@StephenMcConnel made 1 comment.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on JohnThomson and StephenMcConnel).
src/BloomBrowserUI/bookEdit/toolbox/talkingBook/audioRecording.ts line 250 at r2 (raw file):
Previously, JohnThomson (John Thomson) wrote…
If I'm understanding right, since these are attached to the document, all clicks in any toolbox will activate all of them...then a filter will determine that the event didn't originate with the right element and ignore it. I don't suppose it matters very much, but I wonder if we should try to clean up when TB closes?
Of course then we have to reinstate them when it opens...and that's probably after the new buttons get created, so we could just attach them to the buttons, if we do it then (if I'm understanding the problem).
We could also just merge as-is. But it seemed worth asking.
Done.
Also a bit of cleanup in that general area as well. I'm not sure these changes are needed in 6.5 since the bug was not manifesting there.
6504c1f to
3dfffee
Compare
JohnThomson
left a comment
There was a problem hiding this comment.
@JohnThomson made 1 comment and resolved 1 discussion.
Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on StephenMcConnel).
src/BloomBrowserUI/bookEdit/toolbox/talkingBook/audioRecording.ts line 529 at r3 (raw file):
public async setupForRecordingAsync(): Promise<void> { this.isShowing = true; this.bindDocumentDelegatedHandlers();
If this happens every time the tool is opened, then do we still need to call it also in initializeTalkingBookToolAsync()? Given that it has the "off" calls it won't hurt much to do it twice, but better not?
Also, it feels like this method is now doing more than its name says (maybe already was). Time to rename it something like openTool()? There might also be a better way to word the comment about "when the tool is created", which suggests (contrary to the line before) that it only happens once.
Also a bit of cleanup in that general area as well. I'm not sure these changes are needed in 6.5 since the bug was not manifesting there.
This change is
Devin review