Skip to content

[COMMS-1102] Documents: toolbar missing / not styled correctly on mobile - #26648

Merged
ihordubas99 merged 2 commits into
release/18.0from
bug/comms-1102-documents-weird-blue-toolbar-on-mobile-screens
Nov 20, 2026
Merged

ihordubas99 merged 2 commits into
release/18.0from
bug/comms-1102-documents-weird-blue-toolbar-on-mobile-screens

Conversation

@ihordubas99

@ihordubas99 ihordubas99 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Ticket

https://community.openproject.org/wp/COMMS-1102

What are you trying to accomplish?

Since the BlockNote 0.55 bump, the formatting toolbar in Documents is broken on mobile:

  • iOS: the toolbar is pinned to the bottom of the screen, unstyled (bare blue Mantine buttons).
  • Android: the toolbar doesn't show up at all.

After this PR, the toolbar on both platforms is styled, pinned above the virtual keyboard and horizontally scrollable, as BlockNote intends.

Screenshots

photo_2026-11-04_15-31-46 (1)

What approach did you choose and why?

Since 0.55, BlockNote's FormattingToolbarController switches to a new MobileFormattingToolbarController on touch devices while the virtual keyboard is open. That toolbar is portaled into a root on document.body, and the target is hardcoded (<PortalElementOverride target={document.body}>, still the same in 0.57). Two separate problems followed from that:

1. No styles (iOS, Android)
Our editor lives in a shadow root, and blocknote.css was loaded only into that shadow root. The body-level toolbar is outside it, so none of the BlockNote/Mantine CSS applies.

-> block-note-element.ts now also adds blocknote.css to document.head, once (deduplicated by href, so several editors or Turbo reconnects don't add it again). It's the same URL as in the shadow root, so the browser serves it from cache.
I checked the built CSS for unscoped selectors: apart from .bn-* / Mantine classes, it only targets BlockNote attributes (data-content-type, data-text-color, …), which OpenProject uses only inside the editor. The rest of the page is unaffected.

2. Covered by the page (Android)
_base_mobile.sass makes every div:has(page-header) sticky with z-index: var(--main-menu-toggler-z-index) (550). That includes the whole .op-document-view, which then covers the toolbar (z-index: calc(var(--bn-ui-base-z-index) + 40) = 40). I confirmed this on a device via remote debugging: elementFromPoint hit the document view, and raising the toolbar's z-index made it appear.

-> Set BlockNote's own --bn-ui-base-z-index to --main-menu-toggler-z-index on body > .block-note-editor-container, i.e. only the body-level portal root. That lifts the toolbar and its dropdowns, which portal into the same root. The editor inside the shadow root is untouched, because body > can't match there.

Alternatives I rejected

  • Using DesktopFormattingToolbarController (forcing the floating toolbar): it renders inside the shadow root, but it drops BlockNote's mobile UX (toolbar pinned above the keyboard). It also has no width limit, so on a phone it's wider than the screen and its right part is cut off.
  • Capping the floating toolbar's width: it didn't work reliably on iOS, and it fights BlockNote's design instead of using its mobile toolbar.

Upstream
Reported as TypeCellOS/BlockNote#3304: let the mobile toolbar respect portalElements.formattingToolbar. If that lands, change 1 can be removed. Change 2 stays either way, since the sticky header is ours.

AI involvement

Collaborative – AI generated a substantial part of the code; I reviewed and understand every line.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@ihordubas99 ihordubas99 self-assigned this Nov 4, 2026
@github-actions github-actions Bot added the ai: None/Assisted 👤 No AI assistance used OR only snippets. A human effectively wrote and understands all the code. label Nov 5, 2026
@ihordubas99
ihordubas99 force-pushed the bug/comms-1102-documents-weird-blue-toolbar-on-mobile-screens branch from bbb5d77 to 805541a Compare November 5, 2026 10:12
@github-actions github-actions Bot added ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line. and removed ai: None/Assisted 👤 No AI assistance used OR only snippets. A human effectively wrote and understands all the code. labels Nov 5, 2026
@ihordubas99
ihordubas99 marked this pull request as ready for review November 5, 2026 10:26
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/bim/spec/features/bcf/bcf_list_keyboard_spec.rb[1:1:8]
  • rspec ./spec/features/types/variants_index_spec.rb[1:13]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #26648, linked for reference only):

- `rspec ./modules/bim/spec/features/bcf/bcf_list_keyboard_spec.rb[1:1:8]`
- `rspec ./spec/features/types/variants_index_spec.rb[1:13]`

Treat this as a standalone task, unrelated to PR #26648. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #26648 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @ihordubas99 to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @ihordubas99, and request a review from @ihordubas99.
On every commit, set @ihordubas99 as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@judithroth

Copy link
Copy Markdown
Contributor

Hi @ihordubas99
This also needs to go to release/18.0 .

@ihordubas99
ihordubas99 force-pushed the bug/comms-1102-documents-weird-blue-toolbar-on-mobile-screens branch from 805541a to 57012df Compare November 13, 2026 13:39
@ihordubas99
ihordubas99 requested a review from a team as a code owner November 13, 2026 13:39
@ihordubas99
ihordubas99 changed the base branch from dev to release/18.0 November 13, 2026 13:39
@ihordubas99
ihordubas99 removed the request for review from a team November 13, 2026 13:39

@judithroth judithroth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, on my Android device, the toolbar is now there 👏 but I can't open the dropdown where I can switch between paragraph, heading, etc.
On Browserstack iPhone 14, it seems like the dropdown opens below:

image

Since there is no gap on my Android device, it may that I don't see it because it also opens below.

While on BlockNote itself, it openes above:

Screenshot_20261119-155445_Firefox

Can you please check if this is due to us being a lower version than the BlockNote demo site or if it's a bug we need to fix?

@ihordubas99
ihordubas99 force-pushed the bug/comms-1102-documents-weird-blue-toolbar-on-mobile-screens branch from 95f3d94 to 89805a1 Compare November 20, 2026 13:46
@ihordubas99

Copy link
Copy Markdown
Collaborator Author

Hi @judithroth, thanks for the review and great catch!

It's not the BlockNote version, there were two issues:

Dropdown behind the keyboard (iOS + Android). Since Mantine 9.3 (we're on 9.7.4, the demo on 9.1.1), a popover that fits on neither side falls back to bottom instead of the side with more room. Fixed by disabling that via our own MantineProvider around the editor.

Dropdown behind the page (Android). Mantine sets z-index: 300 on dropdowns, below our sticky mobile header (550). Fixed by making the body-level toolbar container a stacking context above the header.
Tested on iOS Safari and a real Android device.

Also, every app on Mantine >= 9.3 should hit issue 1, so I'd open an issue at BlockNote. If they fix it, we can drop our provider. What do you think?

@ihordubas99
ihordubas99 requested an adaptive review from Copilot November 20, 2026 13:49

This comment was marked as outdated.

@judithroth

Copy link
Copy Markdown
Contributor

Also, every app on Mantine >= 9.3 should hit issue 1, so I'd open an issue at BlockNote. If they fix it, we can drop our provider. What do you think?

Fully agree, please do that 👍

@judithroth judithroth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, you were able to fix that, nice 🤩

@judithroth judithroth changed the title [COMMS-1102] Documents: weird blue toolbar on mobile screens [COMMS-1102] Documents: toolbar missing / not styled correctly on mobile Documents: toolbar missing / not styled correctly on mobile Nov 20, 2026
@judithroth judithroth changed the title [COMMS-1102] Documents: toolbar missing / not styled correctly on mobile Documents: toolbar missing / not styled correctly on mobile [COMMS-1102] Documents: toolbar missing / not styled correctly on mobile Nov 20, 2026
@ihordubas99
ihordubas99 merged commit 22198d5 into release/18.0 Nov 20, 2026
24 of 25 checks passed
@ihordubas99
ihordubas99 deleted the bug/comms-1102-documents-weird-blue-toolbar-on-mobile-screens branch November 20, 2026 15:29
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line.

Development

Successfully merging this pull request may close these issues.

3 participants