mirror of https://github.com/gorhill/uBlock.git
Fix delete key handling in element zapper
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/1237#issuecomment-690897502
This commit is contained in:
parent
f0ef680a86
commit
ead49e083a
|
@ -473,6 +473,17 @@ const onCandidateClicked = function(ev) {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
const onKeyPressed = function(ev) {
|
const onKeyPressed = function(ev) {
|
||||||
|
// Delete
|
||||||
|
if (
|
||||||
|
(ev.key === 'Delete' || ev.key === 'Backspace') &&
|
||||||
|
pickerRoot.classList.contains('zap')
|
||||||
|
) {
|
||||||
|
vAPI.MessagingConnection.sendTo(epickerConnectionId, {
|
||||||
|
what: 'zapElementAtPoint',
|
||||||
|
options: { stay: true },
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Esc
|
// Esc
|
||||||
if ( ev.key === 'Escape' || ev.which === 27 ) {
|
if ( ev.key === 'Escape' || ev.which === 27 ) {
|
||||||
onQuitClicked();
|
onQuitClicked();
|
||||||
|
|
|
@ -960,6 +960,8 @@ const onViewportChanged = function() {
|
||||||
// Auto-select a specific target, if any, and if possible
|
// Auto-select a specific target, if any, and if possible
|
||||||
|
|
||||||
const startPicker = function() {
|
const startPicker = function() {
|
||||||
|
pickerRoot.focus();
|
||||||
|
|
||||||
self.addEventListener('scroll', onViewportChanged, { passive: true });
|
self.addEventListener('scroll', onViewportChanged, { passive: true });
|
||||||
self.addEventListener('resize', onViewportChanged, { passive: true });
|
self.addEventListener('resize', onViewportChanged, { passive: true });
|
||||||
self.addEventListener('keydown', onKeyPressed, true);
|
self.addEventListener('keydown', onKeyPressed, true);
|
||||||
|
|
Loading…
Reference in New Issue