diff options
| author | Joren Van Onder <jov@odoo.com> | 2016-07-11 11:27:58 +0200 |
|---|---|---|
| committer | Joren Van Onder <jov@odoo.com> | 2016-07-13 13:58:50 +0200 |
| commit | c902437247d36ca7945d30b8d75b55f4f7c4855e (patch) | |
| tree | d8c3d1c27496a2707a863ab7142b58becb63a76c /addons/barcodes/static/src | |
| parent | 4dc228d01c6bf6238589dcc273812d4c721caa4b (diff) | |
[FIX] barcodes: allow users to 'click' focused buttons with Return
Return key events don't get redispatched and even if they did, it
wouldn't work because 'fake' keypress events don't trigger native HTML
event handlers.
This should be safe because Return cannot start a valid barcode.
Diffstat (limited to 'addons/barcodes/static/src')
| -rw-r--r-- | addons/barcodes/static/src/js/barcode_events.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/barcodes/static/src/js/barcode_events.js b/addons/barcodes/static/src/js/barcode_events.js index 546faee3655..fca30916106 100644 --- a/addons/barcodes/static/src/js/barcode_events.js +++ b/addons/barcodes/static/src/js/barcode_events.js @@ -129,6 +129,10 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, { // Don't catch keypresses which could have a UX purpose (like shortcuts) if (e.ctrlKey || e.metaKey || e.altKey) return; + // Don't catch Return when nothing is buffered. This way users + // can still use Return to 'click' on focused buttons or links. + if (e.which === 13 && this.buffered_key_events.length === 0) + return; // Don't catch events targeting elements that are editable because we // have no way of redispatching 'genuine' key events. Resent events // don't trigger native event handlers of elements. So this means that |
