From 1bc756ee93c2ffd21fd82506f2c29e6fc5a923d0 Mon Sep 17 00:00:00 2001 From: Frank Maximus Date: Tue, 19 May 2020 16:55:43 +0200 Subject: [PATCH] Bolding text inside a link in task title/notes. (#12178) (#12195) * Bolding text inside a link in task title/notes. (#12178) Before: * link target opened in new tab * task edit popup opened Now: * link target opened in new tab Fixes #12178 * Handle PR comments * Added explanation * Switched to classList to improve readability --- website/client/src/components/tasks/task.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/website/client/src/components/tasks/task.vue b/website/client/src/components/tasks/task.vue index d6e78fdd98..45957cf217 100644 --- a/website/client/src/components/tasks/task.vue +++ b/website/client/src/components/tasks/task.vue @@ -976,10 +976,18 @@ export default { edit (e, task) { if (this.isRunningYesterdailies || !this.showEdit) return; - // Prevent clicking on a link from opening the edit modal const target = e.target || e.srcElement; - if (target.tagName === 'A') return; // clicked on a link + /* + * Prevent clicking on a link from opening the edit modal + * + * Ascend up the ancestors of the click target, up until the node defining the click handler. + * If any of them is an element, don't open the edit task popup. + * Needed in case of a link, with a bold and/or italic link description + */ + for (let element = target; !element.classList.contains('task-clickable-area'); element = element.parentNode) { + if (element.tagName === 'A') return; // clicked on a link + } const isDropdown = this.$refs.taskDropdown && this.$refs.taskDropdown.$el.contains(target); const isEditAction = this.$refs.editTaskItem && this.$refs.editTaskItem.contains(target);