smartup
smartup copied to clipboard
[chrome] Open link does not work when <img> tag is inside the <a> tag
When an image is embedded in a link, gestures to open the link in a new tab seem to not do anything.
Starting the gesture on the link itself works fine. Starting the gesture on the image seems broken.
It might be a config issue. I've disabled: 'Image Drag' All 'up' gestures are set to 'open link in background tab'
Example gif:

Example code:
Images wrapped in links<br>
Action: gesture starting on image <br />
Expected: Link is opened in background tab<br />
Actual: nothing happens<br /><br />
images with `user-drag:none` seem to work as expected.
<div class="example">
<div>
<a href="https://google.com" target="_blank">
link without `-webkit-user-drag:'none'`
<img src="https://placekitten.com/200/200" />
</a>
<br />
<a href="https://google.com" target="_blank">
link with `-webkit-user-drag:'none'
<img src="https://placekitten.com/200/201" class="nonDraggableImage" />
</a>
</div>
<div id='info'>
debug info
</div>
</div>
<style>
.nonDraggableImage {
-webkit-user-drag: none;
}
.example {
padding: 1rem;
border: 2px solid grey;
display: flex;
}
.example>* {
padding: 1rem;
flex: '1 1 auto';
}
</style>
<script>
setInterval(() => {
let elem = document.getElementById('info');
elem.innerHTML = `<b>Debug info</b><br/>Active elem<br/>href: ${document.activeElement.href||''}<br/> src: ${document.activeElement.src||''}<br/> txt: ${document.activeElement.txt||''}`
}, 500)
</script>
Config
chrome version:
Google Chrome | 107.0.5304.88 (Official Build) (64-bit) (cohort: Stable)
Revision | f59ffb32abf8c01e9aa298400314bfdf0221b02f-refs/branch-heads/5304@{#1093}
OS | Windows 10 Version 21H2 (Build 19044.2130)
JavaScript | V8 10.7.193.18