diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html index 8fc61b72cb..53e852fba9 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.html @@ -36,6 +36,7 @@ limitations under the License. + @@ -115,14 +116,10 @@ limitations under the License. .path { cursor: pointer; flex: 1; - text-decoration: none; /* Wrap it into multiple lines if too long. */ white-space: normal; word-break: break-word; } - .path:hover :first-child { - text-decoration: underline; - } .oldPath { color: var(--deemphasized-text-color); } @@ -245,6 +242,26 @@ limitations under the License. display: inline-block; margin: -2px 0; padding: var(--spacing-s) 0; + text-decoration: none; + } + .pathLink:hover { + text-decoration: underline; + } + + /** copy on file path **/ + .pathLink gr-copy-clipboard, + .oldPath gr-copy-clipboard { + display: inline-block; + visibility: hidden; + vertical-align: bottom; + text-decoration: none; + --gr-button: { + padding: 0px; + } + } + .pathLink:hover gr-copy-clipboard, + .oldPath:hover gr-copy-clipboard { + visibility: visible; } /** small screen breakpoint: 768px */ @@ -273,7 +290,7 @@ limitations under the License. } .expanded .fullFileName, .truncatedFileName { - display: block; + display: inline; } .expanded .truncatedFileName, .fullFileName { @@ -330,11 +347,18 @@ limitations under the License. class="truncatedFileName"> [[computeTruncatedPath(file.__path)]] + - +
diff --git a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard.js b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard.js index 2ce03e34c5..9be685227a 100644 --- a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard.js +++ b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard.js @@ -53,7 +53,10 @@ Polymer.dom(e).rootTarget.select(); } - _copyToClipboard() { + _copyToClipboard(e) { + e.preventDefault(); + e.stopPropagation(); + if (this.hideInput) { this.$.input.style.display = 'block'; } diff --git a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.html b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.html index 55eb1987ff..05014f1b5a 100644 --- a/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.html +++ b/polygerrit-ui/app/elements/shared/gr-copy-clipboard/gr-copy-clipboard_test.html @@ -90,5 +90,16 @@ limitations under the License. flushAsynchronousOperations(); assert.equal(getComputedStyle(element.$.input).display, 'none'); }); + + test('stop events propagation', () => { + const divParent = document.createElement('div'); + divParent.appendChild(element); + const clickStub = sinon.stub(); + divParent.addEventListener('click', clickStub); + element.stopPropagation = true; + const copyBtn = element.shadowRoot.querySelector('.copyToClipboard'); + MockInteractions.tap(copyBtn); + assert.isFalse(clickStub.called); + }); });