Merge pull request #30490 from overleaf/mg-context-menu-a11y

[web] Add a11y support for context menu

GitOrigin-RevId: 3cbe66ee3ee8345dd0e89f89561928889832a50d
This commit is contained in:
Malik Glossop
2026-01-20 09:06:32 +00:00
committed by Copybot
parent 3e9d3f4d9c
commit 723da5c28a
9 changed files with 370 additions and 233 deletions
@@ -168,12 +168,19 @@ export const addComment = () => {
}
export const deleteSelection: Command = view => {
const { from, to } = view.state.selection.main
if (from === to) return false
if (view.state.selection.ranges.every(range => range.empty)) return false
view.dispatch({
changes: { from, to, insert: '' },
selection: { anchor: from },
const transaction = view.state.changeByRange(range => {
if (range.empty) {
return { changes: [], range }
}
return {
changes: { from: range.from, to: range.to, insert: '' },
range: EditorSelection.cursor(range.from),
}
})
view.dispatch(transaction)
return true
}