First, a background story... I'm one of many happy Grammarly users and I frankly got used to seeing that sweet green circle in the right corner below my writings. As a Github user, I also got used to using it during PR review sessions and issue report submissions so seeing it doesn't work here was kinda a bummer.
So I started digging to figure out what prevents their browser extension from working on Codeberg. Turns out that I'm writing this issue report using CodeMirror v5.12.1. I figured that out by executing the following javascript snippet in the browser console:
$('.CodeMirror')[0].CodeMirror.constructor.version
Additionally, it turns out that CodeMirror is just a sub dependency of another editor package: SimpleMDE
As suspected this is an upstream thing so I continued my exploration inside the go-gitea codebase. There I found this interesting PR: https://github.com/go-gitea/gitea/pull/13333 that replaces SimpleMDE with EasyMDE (IIRC it is a fork of SimpleMDE). Weirdly enough it ended with this issue https://github.com/go-gitea/gitea/issues/13888
So if understood everything correctly, as of writing this:
- current version of Gitea (
v1.13.0) comes with SimpleMDE & CodeMirror v5.12.1
- upcoming version Gitea (
v1.14.0) comes with EasyMDE & CodeMirror v5.58.2
Either way, it is CodeMirror v5 we are dealing with so I took another jump and went to https://codemirror.net just to realize that Grammarly doesn't work there too.
In the meantime, while playing with browser inspector on Codeberg I figured out that Grammarly actually works but behind the scenes. What I mean by that is extension attaches expected controls to <textarea/> receiving keystrokes but CodeMirror uses javascript to keep it hidden behind the editor area. OFC that has nothing to do with Codeberg and exact the same things happens on https://codemirror.net
While there I couldn't fail to notice the top banner advertising CodeMirror v6 so I went there and check. The first feature they advertise is accessibility! OFC that means no javascript shenanigans with <textarea/> but using contenteditable <div/> instead. Unsurprisingly Grammarly browser extension had no trouble finding the target element and my tools got working again. 🎉
Although I spent a great deal of this essay talking about Grammarly aside from free marketing I'm providing them with 🙃 it has nothing to do with it specifically.
Big issue here is that by using CodeMirror all accessibility features are gone! That means real trouble for people relying on assistive technologies and that's far worse than my pet peeve!
Now, I'm not even sure how to resolve this thing. 😰
- Clearly it is not Codeberg's fault but I'm reporting it here for sake of raising awareness
- Supplain chain goes through Gitea, Simple/EasyMDE back to the CodeMirror
- Trying to address it by updating EasyMDE to CodeMirror
v6 is probably a bad idea because it is a completely new project, still in the beta phase and it already went trough some tectonic changes 3 days ago! by switching from https://npm.im/@codemirror/next to https://npm.im/@codemirror/view
At this stage, I'm running out of ideas and starting to giving up 🤷♂️
Any ideas? What would be the best way forward?
PS Usual formatting shortcuts like Ctrl+B for bold and Ctrl+I are also broken although they do work in both Simple & EasyMDE 🤔
First, a background story... I'm one of many happy [Grammarly](https://grammarly.com) users and I frankly got used to seeing that sweet green circle in the right corner below my writings. As a Github user, I also got used to using it during PR review sessions and issue report submissions so seeing it doesn't work here was kinda a bummer.
So I started digging to figure out what prevents their browser extension from working on Codeberg. Turns out that I'm writing this issue report using [CodeMirror](https://codemirror.net) `v5.12.1`. I figured that out by executing the following javascript snippet in the browser console:
```js
$('.CodeMirror')[0].CodeMirror.constructor.version
```
Additionally, it turns out that CodeMirror is just a sub dependency of another editor package: [SimpleMDE](https://simplemde.com)
As suspected this is an upstream thing so I continued my exploration inside the `go-gitea` codebase. There I found this interesting PR: https://github.com/go-gitea/gitea/pull/13333 that replaces SimpleMDE with [EasyMDE](https://easy-markdown-editor.tk) (IIRC it is a fork of SimpleMDE). Weirdly enough it ended with this issue https://github.com/go-gitea/gitea/issues/13888
So if understood everything correctly, as of writing this:
1. current version of Gitea (`v1.13.0`) comes with SimpleMDE & CodeMirror `v5.12.1`
2. upcoming version Gitea (`v1.14.0`) comes with EasyMDE & CodeMirror `v5.58.2`
Either way, it is CodeMirror `v5` we are dealing with so I took another jump and went to https://codemirror.net just to realize that Grammarly doesn't work there too.
In the meantime, while playing with browser inspector on Codeberg I figured out that Grammarly actually works but _behind the scenes._ What I mean by that is extension attaches expected controls to `<textarea/>` receiving keystrokes but CodeMirror uses javascript to keep it hidden behind the _editor_ area. OFC that has nothing to do with Codeberg and exact the same things happens on https://codemirror.net
While there I couldn't fail to notice the top banner advertising CodeMirror `v6` so I went [there](https://codemirror.net/6/) and check. The first feature they advertise is accessibility! OFC that means no javascript shenanigans with `<textarea/>` but using `contenteditable` `<div/>` instead. Unsurprisingly Grammarly browser extension had no trouble finding the target element and my tools got working again. 🎉
Although I spent a great deal of this _essay_ talking about Grammarly aside from free marketing I'm providing them with 🙃 it has nothing to do with it specifically.
**Big issue here is that by using CodeMirror all accessibility features are gone! That means real trouble for people relying on assistive technologies and that's far worse than my pet peeve!**
Now, I'm not even sure how to resolve this thing. 😰
1. Clearly it is not Codeberg's fault but I'm reporting it here for sake of raising awareness
2. Supplain chain goes through Gitea, Simple/EasyMDE back to the CodeMirror
3. Trying to address it by updating EasyMDE to CodeMirror `v6` is probably a bad idea because it is a completely new project, still in the beta phase and it already went trough some tectonic changes 3 days ago! by switching from https://npm.im/@codemirror/next to https://npm.im/@codemirror/view
At this stage, I'm running out of ideas and starting to giving up 🤷♂️
Any ideas? What would be the best way forward?
---
**PS** Usual formatting shortcuts like <kbd>Ctrl</kbd>+<kbd>B</kbd> for bold and <kbd>Ctrl</kbd>+<kbd>I</kbd> are also broken although they do work in both Simple & EasyMDE 🤔