I’ve been investigating a couple of usability issues in FF devtools (based on CM6). They both show a slightly different version of the same underlying issue: that gutter markers lack identity. See:
- Activating code block toggle button with keyboard make them lose their focus state
- Debugger editor gutter with cm6 traps keyboard navigation
In #1, the folding gutter marks are clickable buttons that can be activated by keyboard. When one does so, its DOM gets trashed since the only relevant state for them is the open flag. This causes the user to lose focus on the marker.
In #2, navigating the markers with Tab sometimes triggers a whole recalculation of gutter elements that trashes all markers, again losing the focused element.
For #1, I kind of see how one could vendor foldGutter() and cache markers so that toggling the open state only mutates the DOM. I’ve hacked something along this lines and it works.
However, for #2 I don’t really see a solution unless one vendors gutter() entirely, which (superficially) seems more burdensome that just foldGutter().
Is there a better approach that I’m missing? Is this a use case that CM could support out of the box?