Comments (7)
That did the trick, thanks!
from atom-keymap.
Interesting. We currently call preventDefault
and stopPropagation
to indicate that the keymap system has "consumed" the event by transforming it into the specified command, but I don't actually have a clear picture of exactly what would go wrong if we didn't do that. It's been a long time since that decision was made.
Could you explain the specifics of your situation? Do you have a proposal for how it would work?
from atom-keymap.
The example in this situation is I have a searchable item component. In that component is an input
and a select
dropdown (set to multiple so it acts/looks like a list).
Natively, once the select
is focused, you can use the arrow keys to navigate through the list. You can see that functionality here: http://jsbin.com/geremameme/edit?html,output
I've setup a custom up (and down) key event so that if the input is focused, pressing the down arrow would focus the select
.
With the key-map attaching the down
event, the native down
event is blocked and only the key-map down
is fired.
Ideally it would be nice if I could either:
- Tell key-map to not
preventDefault()
- Call a method inside my component that listens to the event, and tell key-map it's ok to bubble up.
// Badly coded example
window.addEventListener('up-event', (event) => {
// Do something
event.bubble();
});
from atom-keymap.
Could you map the up arrow to the special native!
directive or use the .native-key-bindings
class on your component and do your own event handling?
from atom-keymap.
Yeah, I'm just handling it natively for now. I was just curious if there was a way to use keymap for that event/situation.
from atom-keymap.
You can also call abortKeyBinding
on the emitted command event to tell the keymap system that even though the binding matched and emitted a command, you still want to continue as if the key binding didn't match. This wouldn't prevent other bindings further up in the document from matching the event however. Does that address your issue?
from atom-keymap.
Interesting. That may be the key. Let me test it out and I'll get back to you.
Thanks!
from atom-keymap.
Related Issues (20)
- Partial key mapping can get wrongly resolved HOT 1
- Some keybindings do not work using Greek keyboard on Linux HOT 17
- Uncaught TypeError: Cannot read property 'unmodified' of undefined (possible Mode_switch issue) HOT 2
- Polish letters - not work HOT 1
- Cmd+backslash isn't working yet in JIS keyboard on Mac. HOT 5
- Won't install on Windows HOT 5
- [windows] AltGr-characters collide with Ctrl+Alt hotkeys HOT 3
- On Linux, keymap does not work with Chinese input source enabled
- Caps lock interferes with keybindings
- Keymap: Missing key binding for rendering Python graph with matplotlib in Atom HOT 1
- Don't use KeyboardEvent.code when resolving user keystrokes HOT 6
- Slovak QWERTZ does not resolve keys correctly on macOS HOT 16
- Support DVORAK-QWERTY custom keyboards in macOS HOT 2
- Numeric keypad bindings no longer work HOT 7
- `npm install` reports numerous warnings
- Multiple modifiers are not recognized correctly with non-latin characters due to uppercase checking HOT 8
- it keymap error HOT 2
- Multiple command actions in key map
- Atom confused by non-default keyboard layout and hijacks system keybinding
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-keymap.