diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-15 09:04:34 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-08-16 09:14:40 +0200 |
commit | 571f821f9fe5e9c5522c8803b6a95825e318ef01 (patch) | |
tree | 27298841d81c164b6c0be8bb88f7bca55de359d0 /server/sonar-web/src/main | |
parent | ba116aa74c68625be4bedbca31a10e21d5b86055 (diff) | |
download | sonarqube-571f821f9fe5e9c5522c8803b6a95825e318ef01.tar.gz sonarqube-571f821f9fe5e9c5522c8803b6a95825e318ef01.zip |
SONAR-9490 Allow to click on links inside issues comments
Diffstat (limited to 'server/sonar-web/src/main')
3 files changed, 19 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js index ee41dddc847..54836503b39 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js +++ b/server/sonar-web/src/main/js/components/issue/components/IssueCommentLine.js @@ -46,6 +46,12 @@ export default class IssueCommentLine extends React.PureComponent { openPopup: '' }; + handleCommentClick = (event /*: Event & {target: HTMLElement}*/) => { + if (event.target.tagName === 'A') { + event.stopPropagation(); + } + }; + handleEdit = (text /*: string */) => { this.props.onEdit(this.props.comment.key, text); this.toggleEditPopup(false); @@ -87,6 +93,9 @@ export default class IssueCommentLine extends React.PureComponent { <div className="issue-comment-text markdown" dangerouslySetInnerHTML={{ __html: comment.htmlText }} + onClick={this.handleCommentClick} + role="Listitem" + tabIndex={0} /> <div className="issue-comment-age"> ({moment(comment.createdAt).fromNow()}) diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueCommentLine-test.js.snap b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueCommentLine-test.js.snap index c98cf19fd04..9d4ea6fa3aa 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueCommentLine-test.js.snap +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/__snapshots__/IssueCommentLine-test.js.snap @@ -35,6 +35,9 @@ exports[`should open the right popups when the buttons are clicked 3`] = ` "__html": "<b>test</b>", } } + onClick={[Function]} + role="Listitem" + tabIndex={0} /> <div className="issue-comment-age" @@ -130,6 +133,9 @@ exports[`should render correctly a comment that is not updatable 1`] = ` "__html": "<b>test</b>", } } + onClick={[Function]} + role="Listitem" + tabIndex={0} /> <div className="issue-comment-age" @@ -167,6 +173,9 @@ exports[`should render correctly a comment that is updatable 1`] = ` "__html": "<b>test</b>", } } + onClick={[Function]} + role="Listitem" + tabIndex={0} /> <div className="issue-comment-age" diff --git a/server/sonar-web/src/main/less/components/issues.less b/server/sonar-web/src/main/less/components/issues.less index 37ee80aeb50..9f0274fcfc6 100644 --- a/server/sonar-web/src/main/less/components/issues.less +++ b/server/sonar-web/src/main/less/components/issues.less @@ -213,6 +213,7 @@ padding-right: 5px; line-height: 18px; .formatted; + .no-outline; } .issue-comment-actions { |