Fix right clicking on links being treated as link clicks (#2355)

This commit is contained in:
absidue 2022-06-30 20:53:15 +02:00 committed by GitHub
parent 8c495ca94b
commit 65d36852ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -334,14 +334,17 @@ export default Vue.extend({
}) })
$(document).on('auxclick', 'a[href^="http"]', (event) => { $(document).on('auxclick', 'a[href^="http"]', (event) => {
// auxclick fires for all clicks not performed with the primary button
// only handle the link click if it was the middle button,
// otherwise the context menu breaks
if (event.button === 1) {
this.handleLinkClick(event) this.handleLinkClick(event)
}
}) })
}, },
handleLinkClick: function (event) { handleLinkClick: function (event) {
const el = event.currentTarget const el = event.currentTarget
console.log(this.usingElectron)
console.log(el)
event.preventDefault() event.preventDefault()
// Check if it's a YouTube link // Check if it's a YouTube link