-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normal mode isolation #176
Conversation
Upon manual testing this did not break any functionally. Since this updates the Minor from 3 to 6 there should not be any breaking changes. The library is upgraded such that a minor modification can be made, allowing us to properly isolate website behaviour from Vimari (normal mode). I figured it best to perform this modification on the latest version of Mousetrap such that possible new features are included.
To be able to stop the propagation of events to the website but still capture them in Vimari we need to listen to the keyEvents using the onCapture flag. Something that has not yet been implemented in Mousetrap (see ccampbell/mousetrap#400).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks! Happy for you to merge when ready.
@@ -1,5 +1,9 @@ | |||
// Custom behaviour for Vimari implemented at line 185. Be aware of this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good callout.
Thanks a lot for this feature — might be super useful! Do you have any advices on disabling ESC to exit Safari's full screen? |
@gaisin Next to ESC you can also use CTRL + [ to exit insert mode which would solve your problem I think. Might look in to making these bindings (enter and exit insert mode) configurable as wel in the future. |
@nbelzer Thanks, that works for me! |
@nbelzer On previous Safari versions where TamperMonkey still worked I had my own solution for this, basically back then I did it by adding an event-listener on ESC preventing default behaviour like this, which was sufficient. Having this in vimari would rid my #1 annoyance with Safari. const ESC_KEY = 27;
const KEYPRESS_EVENT = "keypress";
window.addEventListener(KEYPRESS_EVENT,
event => event.keyCode === ESC_KEY && event.preventDefault()
); |
@nbelzer Tested |
@Hultner Thanks for the detailed response. At the moment I'm quite busy with University again but hopefully I'll have some time to look deeper into the issue this weekend. It should be possible to either make the bindings variable or implement something similar to the logic you presented to avoid this problem completely. I believe the issue here to be similar to what is described in #200 so I'll continue discussion there. |
@nbelzer Thanks for the swift reply, and that is of course very understandable, university is of course more important and I don't expect you to put time into this unless it's something you want to do and feel you have the time and capacity to do. With that said if you do end up looking into the issue (over this weekend or other time), do feel free to reach out to me if I can assist in any way. I think the sweetest option would be if there was a setting to always preventDefault for escape, as well as rebinding, for instance some may want to rebind to ^C which works in normal vim but also works on pretty much all keyboards since it doesn't use any special characters. For me using Esc (actually Caps Lock rebound) is so ingrained in my muscle memory that I end up hitting it all the time whenever I interact with text even if I'm not using vim. At this point it's like the period at the end of a sentence, a reflex deeply ingrained in my reptilian brain. |
Resolves #170, #168, #148, #110
Normal mode is the mode where all Vimari bindings work, however as mentioned in for example #168 and #148 these can overlap with the keybindings set on the webpage. This can be a rather frustrating experience to the end user.
Insert mode is the mode where Vimari bindings are disabled and you can interact with the website. Currently this mode is automatically enabled when you are editing a text field.
This PR brings back the isolation between website and Vimari as you would experience in similar extensions such as Vimium. It works as follows:
Changes
1.3.5
to1.6.5
). This was a minor update and should therefore not cause any issues. However I'll keep looking out for weird behaviour.Whats next?