Skip to content

fix(mobile): give the editor toolbar 44px tap targets and dock the "more" menu as an action sheet - #1298

Open
JonasGao wants to merge 1 commit into
blinkospace:mainfrom
JonasGao:fix/mobile-editor-toolbar-touch
Open

JonasGao wants to merge 1 commit into
blinkospace:mainfrom
JonasGao:fix/mobile-editor-toolbar-touch

Conversation

@JonasGao

Copy link
Copy Markdown

Summary

The editor toolbar was built for the pointer: 23px hit targets and vditor's 25px toolbar buttons, far below the 44×44pt minimum tap target of the iOS Human Interface Guidelines.

 vditor toolbar (below md)
-  block layout, floated 25px items
+  flex, nowrap, 44x44 items, scrolls horizontally

 app toolbar row (Editor/index.tsx)
   <div class="flex w-full items-center gap-1 mt-auto">
-    {renderToolbar()}
+    <div class="min-w-0 flex-1 overflow-x-auto md:contents">    // scrolls on phones, display: contents on desktop
+      {renderToolbar()}                                        // IconButton: 23px -> 44px on phones
+    </div>
     {renderRightToolbar()}                                     // send button: 60x32 -> 76x44 on phones
   </div>

 vditor "more" menu
-  absolutely positioned inside its toolbar item, which the scrolling toolbar clips
+  moved to <body> when it opens, position: fixed, docked to the viewport
+  submenus (Headings, Export) expand inline

setupMobileMoreMenu() in editorUtils.tsx attaches once vditor has built its toolbar, closes the moved menu the way vditor's own hidePanel() does, and returns a disposer that runs when the editor is destroyed. It is a no-op at 768px and up, and when vditor's toolbar structure is not found.

The editor's minimum height in dialogs drops from 50vh to 34vh on phones, leaving room for the toolbar and the keyboard.

Pairs with #1296: once vditor binds click on iPhone as well, the sheet's :active feedback also works there.

Evidence

Chromium at 390×844, Android user agent, main vs this branch:

Before After
Editor toolbar on main: 25px and 23px targets Editor toolbar with this PR: 44px targets, capsule send button

Measured: vditor items 25×26 to 44×44, app toolbar buttons 23×23 to 44×44, send button 60×32 to 76×44. The vditor toolbar now scrolls (scrollWidth 400 over clientWidth 370) instead of overflowing.

"More" menu:

Before After After, Headings expanded
More menu on main: dropdown inside the toolbar item More menu with this PR: action sheet docked to the viewport Headings submenu expanded inline

After, the menu is position: fixed in <body>, 374×314 at 8px from the sides, fully inside the viewport and topmost at its centre.

Inside the bottom sheet from #1297 (iOS user agent, both branches applied):

Editor toolbar inside the bottom sheet with this PR

Merge Danger

Door: two-way

Blast Radius: Mobile editor

  • IconButton is shared with the AI chat inputs. There the container keeps its size and only the icon grows to 22px on phones.
  • setupMobileMoreMenu() and the .blinko-more-sheet CSS read vditor 3.11.2's DOM: .vditor-toolbar__item:last-child > .vditor-hint, toggled through inline display. If that structure changes, the function no-ops and the menu stays inside the scrolling toolbar, which clips it.

🤖 Generated with Claude Code

…ore" menu as an action sheet

The editor toolbar was built for the pointer: 23px hit targets and
vditor's 25px toolbar buttons, far below the 44x44pt minimum tap target
of the iOS Human Interface Guidelines and hard to hit with a thumb.

- toolbar items and the send button use 44x44 tap targets (desktop keeps
  the compact sizes)
- with the larger targets the rows no longer fit a phone, so vditor's
  toolbar and the app's toolbar row scroll horizontally
- vditor positions the "more" menu inside its toolbar item, where a
  scrolling toolbar would clip it, so the menu is moved to <body> when
  it opens and styled as a viewport-docked action sheet; nested submenus
  (Headings, Export) expand inline as an accordion and every row gets
  the same 44px target
- the editor's minimum height in dialogs drops from 50vh to 34vh below md,
  leaving room for the toolbar and the keyboard

setupMobileMoreMenu() attaches once vditor has built its toolbar, closes
the moved menu the way vditor's own hidePanel() does, and returns a
disposer that runs when the editor is destroyed. It is a no-op at
>= 768px and when the expected toolbar structure is not found.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant