From 4bfa18fff38cd190c266b7fd9428f1a7f8e6998d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 6 Aug 2018 19:08:07 +0200 Subject: [PATCH] Do not change location hash when clicking on links issue7596 review49521002 --- src/common.js | 6 ++++-- src/sao.js | 6 ++++-- src/screen.js | 1 + src/tab.js | 9 ++++++--- src/view/form.js | 3 ++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/common.js b/src/common.js index 3d551b35de..1eb7e981f4 100644 --- a/src/common.js +++ b/src/common.js @@ -3158,7 +3158,8 @@ }).append(jQuery('', { 'href': '#' }).append(this._format_action(content))) - .click(function() { + .click(function(evt) { + evt.preventDefault(); if (this.action_activated) { this.action_activated(action_id); } @@ -3209,7 +3210,8 @@ }).append(jQuery('', { 'href': '#' }).append(this._format(value))) - .click(function() { + .click(function(evt) { + evt.preventDefault(); if (this.match_selected) { this.match_selected(value); } diff --git a/src/sao.js b/src/sao.js index 77970f5799..6f1b12da8e 100644 --- a/src/sao.js +++ b/src/sao.js @@ -565,7 +565,8 @@ var Sao = {}; icon.attr('src', Sao.common.ICONFACTORY.get_icon_url(menu_item[2])); a.append(menu_item[1]); - a.click(function() { + a.click(function(evt) { + evt.preventDefault(); Sao.favorites_menu_clear(); // ids is not defined to prevent to add suffix Sao.Action.exec_keyword('tree_open', { @@ -582,7 +583,8 @@ var Sao = {}; 'role': 'presentation' }).append(jQuery('', { 'href': '#' - }).click(function() { + }).click(function(evt) { + evt.preventDefault(); Sao.favorites_menu_clear(); Sao.Tab.create({ 'model': Sao.main_menu_screen.model_name + diff --git a/src/screen.js b/src/screen.js index 27c61cd0cd..57797fd561 100644 --- a/src/screen.js +++ b/src/screen.js @@ -274,6 +274,7 @@ }.bind(this)); }, bookmark_activate: function(e) { + e.preventDefault(); var domain = e.data; this.set_text(this.screen.domain_parser().string(domain)); this.do_search(); diff --git a/src/tab.js b/src/tab.js index 08554acc44..3a1de09fa2 100644 --- a/src/tab.js +++ b/src/tab.js @@ -390,7 +390,8 @@ 'aria-hidden': true }).append('×')).append(jQuery('', { 'class': 'sr-only' - }).append(Sao.i18n.gettext('Close'))).click(function() { + }).append(Sao.i18n.gettext('Close'))).click(function(evt) { + evt.preventDefault(); tab.close(); })) .append(tab.name_el); @@ -543,7 +544,8 @@ 'tabindex': -1 }).append( button.attributes.string || '')) - .click(function() { + .click(function(evt) { + evt.preventDefault(); screen.button(button.attributes); }) .appendTo(menu); @@ -559,7 +561,8 @@ 'href': '#', 'tabindex': -1 }).append(action.name)) - .click(function() { + .click(function(evt) { + evt.preventDefault(); var prm = jQuery.when(); if (this.screen.modified()) { prm = this.save(); diff --git a/src/view/form.js b/src/view/form.js index 9aaf484385..116d9b300e 100644 --- a/src/view/form.js +++ b/src/view/form.js @@ -1986,7 +1986,8 @@ function eval_pyson(value){ return function(option) { dropdown.append(jQuery('
  • ').append(jQuery('', { 'href': '#' - }).append(option).click(function() { + }).append(option).click(function(evt) { + evt.preventDefault(); document.execCommand(properties.command, false, option); }))); };