diff --git a/options/onoffswitch.css b/options/onoffswitch.css index 8085cf55..6d262ac5 100644 --- a/options/onoffswitch.css +++ b/options/onoffswitch.css @@ -80,6 +80,7 @@ bottom: 0; margin: 0; padding: 0 4px 0 18px; + pointer-events: none; } .entry .onoffswitch span { position: absolute; diff --git a/popup/popup.css b/popup/popup.css index 60455d2e..76549a2e 100644 --- a/popup/popup.css +++ b/popup/popup.css @@ -239,6 +239,9 @@ html[style] .entry-content { .entry .onoffswitch { padding: 0 0 0 6px; } +.entry .onoffswitch input { + pointer-events: none; +} .entry:nth-child(even) { background-color: rgba(0, 0, 0, 0.05); diff --git a/popup/popup.js b/popup/popup.js index dd7977ac..c1d0330e 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -439,6 +439,7 @@ function createStyleElement(style) { const sel = 'span.frame-url'; const frameEl = $(sel, entry) || styleName.insertBefore($create(sel), styleName.lastChild); frameEl.title = frameUrl; + frameEl.onmousedown = handleEvent.maybeEdit; } entry.classList.toggle('frame', Boolean(frameUrl)); @@ -626,7 +627,8 @@ Object.assign(handleEvent, { return; } // open an editor on middleclick - if (event.target.matches('.entry, .style-name, .style-edit-link')) { + const el = event.target; + if (el.matches('.entry, .style-edit-link') || el.closest('.style-name')) { this.onmouseup = () => $('.style-edit-link', this).click(); this.oncontextmenu = event => event.preventDefault(); event.preventDefault(); @@ -634,7 +636,7 @@ Object.assign(handleEvent, { } // prevent the popup being opened in a background tab // when an irrelevant link was accidentally clicked - if (event.target.closest('a')) { + if (el.closest('a')) { event.preventDefault(); return; }