[FIX] mail: sets the push-to-talk key events of the call in capture mode

Before this commit, the `keydown` and `keyup` events of the call feature
were in bubble mode, which could prevent them from operating when some
other listeners would prevent the propagation of the event.

Since push-to-talk is supposed to always be usable, the listeners
are now in capture mode.

It was first made apparent with the addition of a `stopPropagation()` in
the `chatWindow` here: https://github.com/odoo/odoo/pull/127638

closes odoo/odoo#128897

X-original-commit: 1466a6bc471ed583966e959b47f10bdc64837732
Signed-off-by: Didier Debondt (did) <did@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Thanh Dodeur
2023-07-18 19:28:18 +02:00
parent 96a98f4f4c
commit 21aef5beb9
2 changed files with 4 additions and 4 deletions
@@ -21,8 +21,8 @@ export class CallSettings extends Component {
this.state = useState({
userDevices: [],
});
useExternalListener(browser, "keydown", this._onKeyDown);
useExternalListener(browser, "keyup", this._onKeyUp);
useExternalListener(browser, "keydown", this._onKeyDown, { capture: true });
useExternalListener(browser, "keyup", this._onKeyUp, { capture: true });
onWillStart(async () => {
if (!browser.navigator.mediaDevices) {
// zxing-js: isMediaDevicesSuported or canEnumerateDevices is false.
@@ -217,7 +217,7 @@ export class Rtc {
this.soundEffectsService.play("push-to-talk-on", { volume: 0.3 });
}
this.setTalking(true);
});
}, { capture: true });
browser.addEventListener("keyup", (ev) => {
if (
!this.state.channel ||
@@ -234,7 +234,7 @@ export class Rtc {
() => this.setTalking(false),
this.userSettingsService.voiceActiveDuration || 0
);
});
}, { capture: true });
browser.addEventListener("pagehide", () => {
if (this.state.channel) {