[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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user