Hi Team,
I have using prosemirror for quite some time now and its really easy it use and pretty cool too.
however, there is one thing I am unable to perform over a prose mirror instance is that keyboard navigation, in order to support accessibility on my webpage.
I searched the docs, didnāt find any suitable info for enabling accessibility, can somebody help me out here.
The core library should be accessible by default. The menu module is pretty terrible, in terms of keyboard access and screen-reader support, but easy enough to replace.
The prosemirror-menu package isnāt part of the core, and should be taken more as an example of how a menu can work than a production-quality package. Most serious integrations display commands in a custom way.
Hey @marijn,
i have a requirement as part of keyboard navigation that I need to exit out of the currently focussed editor when i press the key āescapeā while the focus is inside the editor.
I have added an event handler for the keypress event to capture the āescapeā key , but however I am not sure how to remove the focus from current editor, because I donāt see any āblur()ā on EditorView
instance.
handleKeyDown: (view, event) => {
console.log('key Down event', event);
// when escape key is pressed, move the focus away from canvas
if (event.key === 'Escape') {
// view.blur(); // unfortunately there is no blur() method on EditorView
}
return false;
},
@marijn Also, do you know how I can ignore certain keys from being entered into editor. eg. tab key looks irrelevant to us in our editor, so we want to ignore it altogether.
how can we prevent this key from ever being feeded to the editor?
If you register a DOM event handler that returns true without preventDefault-ing the event, ProseMirror will not further handle it.
That being said, you have pretty much full control over what keys are bound, so unless you bind Tab, you shouldnāt worry about the editor handling it.