Skip to content

feat: keep modal actions out of the scrollable body - #3419

Merged
AlexAndBear merged 2 commits into
mainfrom
fix/modal-actions-outside-scroll-area
Sep 22, 2026
Merged

AlexAndBear merged 2 commits into
mainfrom
fix/modal-actions-outside-scroll-area

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Description

OcModal renders one confirm button, driven by the modal store. A modal that needs a second or third button, or labels derived from its own state, had no way to express that — so seven of them set hideActions: true and rendered their own copy of the footer markup inside the modal body instead.

The body is the scroll container. Those buttons therefore belong to the scrolling content: they scroll out of view with long content, and they sit inside the body's padding rather than in the footer.

OcModal now gives its actions row an id, and a custom component teleports its buttons in there. The buttons stay in the component's own template, with its own state and handlers — only where they render changes.

Updated modals

  • CreateLinkModal
  • CreateFolderModal
  • CreateSpaceModal
  • UnsavedChangesModal
  • AppTokenModal
  • ResourceConflictModal
  • DatePickerModal

Their dispatches move from hideActions: true to hideConfirmButton: true, so the footer renders but stays empty until the component fills it. The ten remaining hideActions: true dispatches are modals with no actions at all (FilePickerModal, LocationPickerModal, EmojiPickerModal, SaveAsModal) and are unchanged.

Notes for review

  • <teleport defer> is needed because the actions row renders after the body. defer is Vue 3.5+.
  • CreateFolderModal and CreateSpaceModal submit a <form>. Their confirm button now sits outside it, so the form has an id and the button points at it with form, which keeps Enter submitting.
  • Specs of migrated components stub teleport so the buttons render in place; without it they render nowhere and the assertions fail.

Side note: a second commit stops a form's text editor from stealing the focus

useTextEditor focused itself on mount for every non-readonly editor. That is what the text editor app wants, but not a form where the editor is one field among several — revealing the create-space options moved the focus off the space name.

TextEditorOptions gains autofocus, defaulting to the previous behaviour, and the three places where the editor is not the first field opt out: the space description, the banner details in the admin settings, and the mail compose body (which sits after From, To, CC, BCC and Subject).

Not unit tested: the editor spec mounts detached, so isFocused stays false whether or not the editor autofocuses, and a test would pass either way.

Related Issue

  • No issue, found while working on the create-space modal.

How Has This Been Tested?

  • test environment: pnpm check:all (4142 unit tests), plus the create-folder modal checked manually against a local OpenCloud backend
  • test case 1: open a migrated modal and confirm its buttons render in the footer, not in the body
  • test case 2: a modal with long content scrolls its body while the buttons stay put
  • test case 3: pressing enter in the create-folder and create-space name field still submits
  • test case 4: the multi-step modals (create folder, create space) still switch between Back and Continue/Create
  • test case 5: the modals with no actions at all are unchanged

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@AlexAndBear AlexAndBear self-assigned this Sep 22, 2026
Modals with more than the one store-driven confirm button used to opt out
of the footer with `hideActions` and render their own copy of it inside
the modal body. That body is the scroll container, so those buttons
scrolled away with the content and sat on the wrong side of the border.

`OcModal` now exposes its actions row as a teleport target, so a custom
component keeps writing its buttons in its own template while they render
in the real footer.
@AlexAndBear
AlexAndBear force-pushed the fix/modal-actions-outside-scroll-area branch from 9d9d52d to 4c2a1e7 Compare September 22, 2026 08:55
@github-project-automation github-project-automation Bot moved this to Qualification in OpenCloud Team Board Sep 22, 2026
@AlexAndBear AlexAndBear moved this from Qualification to In Progress in OpenCloud Team Board Sep 22, 2026
The editor focused itself on mount, which is what the text editor app
wants but not a form where it is one field among several: revealing the
create-space options moved the focus off the space name, same for the
banner details in the admin settings.

`autofocus` opts out of it and defaults to the previous behaviour.
@AlexAndBear
AlexAndBear force-pushed the fix/modal-actions-outside-scroll-area branch from 87f626d to e4a7ba6 Compare September 22, 2026 09:26
@AlexAndBear
AlexAndBear merged commit d30e9f6 into main Sep 22, 2026
31 checks passed
@AlexAndBear
AlexAndBear deleted the fix/modal-actions-outside-scroll-area branch September 22, 2026 13:28
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenCloud Team Board Sep 22, 2026
@openclouders openclouders mentioned this pull request Sep 22, 2026
1 task
@AlexAndBear AlexAndBear changed the title Keep modal actions out of the scrollable body fix: keep modal actions out of the scrollable body Sep 29, 2026
@AlexAndBear AlexAndBear changed the title fix: keep modal actions out of the scrollable body feat: keep modal actions out of the scrollable body Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants