[FIX] point_of_sale: popup behavior on text fields

The top popup, by default, confirm/cancel when Enter/Esc key is
pressed. This behaviour should be ignored when the focus is in
text input fields.

closes odoo/odoo#96769

X-original-commit: 29b34ff8d6ee368add91f58cc4db9533d2779a77
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Joseph Caburnay
2022-07-27 08:00:13 +02:00
parent 537eff87d5
commit 170aa05182
@@ -62,7 +62,10 @@ odoo.define('point_of_sale.PosPopupController', function(require) {
}
}
_onWindowKeyup(event) {
if (!this.topPopup) return;
const eventIsFromInputField = event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA';
const shouldHandleKey = this.topPopup && !eventIsFromInputField;
if (!shouldHandleKey) return;
if (event.key === this.topPopup.props.cancelKey) {
this.env.posbus.trigger(`cancel-popup-${this.topPopup.props.id}`);
} else if (event.key === this.topPopup.props.confirmKey) {