diff --git a/app/assets/javascripts/discourse/widgets/link.js.es6 b/app/assets/javascripts/discourse/widgets/link.js.es6
index a762a1e74d3..611c41ac396 100644
--- a/app/assets/javascripts/discourse/widgets/link.js.es6
+++ b/app/assets/javascripts/discourse/widgets/link.js.es6
@@ -33,7 +33,7 @@ export default createWidget('link', {
buildAttributes(attrs) {
return {
href: this.href(attrs),
- title: attrs.title ? I18n.t(attrs.title) : this.label(attrs)
+ title: attrs.title ? I18n.t(attrs.title, attrs.titleOptions) : this.label(attrs)
};
},
diff --git a/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6 b/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6
index b4cd572c96c..f66b8497375 100644
--- a/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6
+++ b/app/assets/javascripts/discourse/widgets/search-menu-results.js.es6
@@ -5,6 +5,7 @@ import { createWidget } from 'discourse/widgets/widget';
import { h } from 'virtual-dom';
import { iconNode } from 'discourse-common/lib/icon-library';
import highlightText from 'discourse/lib/highlight-text';
+import { escapeExpression } from 'discourse/lib/utilities';
class Highlighted extends RawHtml {
constructor(html, term) {
@@ -30,6 +31,8 @@ function createSearchResult({ type, linkField, builder }) {
href: r.get(linkField),
contents: () => builder.call(this, r, attrs.term),
className: 'search-link',
+ title: 'search.link_title',
+ titleOptions: { term: escapeExpression(attrs.term) },
searchResultId,
searchResultType: type,
searchContextEnabled: attrs.searchContextEnabled,
@@ -95,7 +98,7 @@ createSearchResult({
type: 'tag',
linkField: 'url',
builder(t) {
- const tag = Handlebars.Utils.escapeExpression(t.get('id'));
+ const tag = escapeExpression(t.get('id'));
return h('a', { attributes: { href: t.get('url') }, className: `tag-${tag} discourse-tag ${Discourse.SiteSettings.tag_style}`}, tag);
}
});
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 45bc066d7d8..ea284289203 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1349,6 +1349,7 @@ en:
one: "1 result for {{term}}"
other: "{{count}} results for {{term}}"
title: "search topics, posts, users, or categories"
+ link_title: "search result for '{{term}}'"
no_results: "No results found."
no_more_results: "No more results found."
searching: "Searching ..."