1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-17 07:52:42 +01:00
uBlock/src/js/scriptlets
Rory O’Kane be111c4036
In Element Zapper, support Mac keyboards’ Delete key (#3770)
Override the Backspace key, not just the Delete key, as Mac keyboards have Backspace as the only delete key and label it Delete.

Source of key value: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values#Editing_keys

More background on Mac keyboard shortcuts: Mac keyboards can emulate Delete using fn+Delete, meaning Forward Delete, but Mac software does not use it except in text editing. When deletion is dangerous, Mac software requires holding a modifier key in conjuction with Delete, but I think it’s better to make deletion easy in this case.

This new binding has a potential downside: if the user Backspace key normally goes Back in history (which can differ across OSs and browsers), this will change the behavior to delete the selected element instead. If the user really wants to go back in history, they will have to press Escape to leave the mode and then press Backspace, or they will have to press an alternative keyboard shortcuts such as Alt+Left. I think the user will rarely want to go back in history in the middle of picking an element, though.

That downside could be mitigated by conditioning the key check on `runtime.PlatformOs` (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/PlatformOs). But that would complicate the code a lot compared to the importance of this feature, and such detection would still fail to capture the user’s intent accurately in all cases. I think it’s better to unconditionally accept both Backspace (Delete) and Delete (Forward Delete).
2020-02-28 14:28:00 -05:00
..
cosmetic-logger.js Log procedural cosmetic exception filters 2019-09-30 18:21:24 -04:00
cosmetic-off.js guard against future instances of issue fixed in #3721 2018-05-03 09:55:36 -04:00
cosmetic-on.js guard against future instances of issue fixed in #3721 2018-05-03 09:55:36 -04:00
dom-inspector.js Code review re. dynamically loaded vapi-client-extra.js 2019-09-26 15:57:55 -04:00
dom-survey-elements.js Fine tune cosmetic filtering badge-related code 2019-11-03 09:38:36 -05:00
dom-survey-scripts.js Fine tune script tags survey scriptlet 2019-11-01 14:28:15 -04:00
element-picker.js In Element Zapper, support Mac keyboards’ Delete key (#3770) 2020-02-28 14:28:00 -05:00
load-large-media-all.js guard against future instances of issue fixed in #3721 2018-05-03 09:55:36 -04:00
load-large-media-interactive.js Work toward modernizing code base: promisification 2019-09-17 15:15:01 -04:00
noscript-spoof.js fix #308, #3436, https://github.com/uBlockOrigin/uBlock-issues/issues/155 2018-08-31 18:47:02 -04:00
should-inject-contentscript.js Minor generic code review of changes since 1.18.2 2019-02-02 08:09:34 -05:00
subscriber.js Work toward modernizing code base: promisification 2019-09-17 15:15:01 -04:00