Merge pull request #36105 from overleaf/mg-focus-floating-menu

Hide floating menu and comment context menu item in focus mode

GitOrigin-RevId: 4cc55f5cebae5e88ea1d1c03a9ac270e43c3073e
This commit is contained in:
Malik Glossop
2026-09-17 11:50:35 +00:00
committed by Copybot
parent f513b1aa52
commit e567abe71a
4 changed files with 44 additions and 2 deletions
@@ -365,6 +365,35 @@ describe('editor context menu', { scrollBehavior: false }, function () {
})
})
describe('when in focus mode', function () {
it('should hide the Add Comment item but keeps the other actions', function () {
const scope = mockScope()
cy.mount(
<TestContainer>
<EditorProviders
scope={scope}
features={{ trackChangesVisible: true }}
layoutContext={{ focusMode: true }}
>
<CodeMirrorEditor />
</EditorProviders>
</TestContainer>
)
cy.get('.cm-line').eq(10).rightclick()
cy.findByRole('menu').within(() => {
cy.findByRole('menuitem', { name: /cut/i }).should('be.enabled')
cy.findByRole('menuitem', { name: /copy/i }).should('be.enabled')
cy.findByRole('menuitem', { name: /suggest edits/i }).should(
'be.enabled'
)
cy.findByRole('menuitem', { name: /comment/i }).should('not.exist')
})
})
})
describe('when text is selected', function () {
it('should enable Cut, Copy, Paste, Delete, Suggest edits, and Comment', function () {
const scope = mockScope()