Skip to content

editor: add input & menu to select different font sizes#9788

Open
01zulfi wants to merge 10 commits into
masterfrom
editor/font-size-selector
Open

editor: add input & menu to select different font sizes#9788
01zulfi wants to merge 10 commits into
masterfrom
editor/font-size-selector

Conversation

@01zulfi

@01zulfi 01zulfi commented May 1, 2026

Copy link
Copy Markdown
Member

Description

image

QA Scope

Test on web and mobile.

Type of Change

  • Bug fix
  • Feature

Visuals

  • Attached relevant screenshots / screen recording / GIF
  • N/A (not a feature or no UI changes)

Testing

  • Ran all E2E tests
  • Ran all integration tests
  • Added/updated tests for this change (if needed)
  • N/A (tests not needed — explanation provided below)

If tests were not added, explain why

Platform

  • Web
  • Mobile
  • Desktop

Sign-off

  • QA passed
  • UI/UX passed

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
Comment thread packages/ui/src/components/menu/index.tsx
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

Cloudflare Pages Preview

https://142aef42.notesnook-app.pages.dev

Commit: 8f5e58b

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

Desktop Previews

Commit: 8f5e58b

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

@thecodrr thecodrr 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.

I think we should go with the Google Docs UX i.e. an input with a dropdown menu as well:

Image

@01zulfi 01zulfi changed the title editor: add menu to select different font sizes editor: add input & menu to select different font sizes May 5, 2026
Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
@01zulfi
01zulfi force-pushed the editor/font-size-selector branch from b94dbc4 to 06e8daf Compare May 5, 2026 07:16
@01zulfi
01zulfi requested a review from thecodrr May 5, 2026 09:05
Comment thread packages/editor/src/toolbar/tools/font.tsx Outdated
Comment thread packages/editor/src/toolbar/tools/font.tsx
Comment on lines +99 to +100
const focusedItem = items[nextIndex];
if (focusedItem) onKeyboardFocus?.(focusedItem);

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.

I don't fully understand what onKeyboardFocus is for.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In Google Docs, when we navigate with arrowup/arrowdown in the font sizes menu, it sets the menu item as the input value. I replicated that behavior here.

For that I needed a callback to run when a menu item is focused via a keyboard press i.e. arrowup/arrowdown

@thecodrr thecodrr May 8, 2026

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.

Side effect: up/down keys change the value and if you close the menu by clicking away, it applies the value to the text instead of cancelling/discarding it. The change should only be applied in 2 cases:

  1. User presses Enter in input
  2. User clicks/selects a menu item

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>

@thecodrr thecodrr 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.

Side effect: up/down keys change the value and if you close the menu by clicking away, it applies the value to the text instead of cancelling/discarding it. The change should only be applied in 2 cases:

  • User presses Enter in input
  • User clicks/selects a menu item

@01zulfi

01zulfi commented May 11, 2026

Copy link
Copy Markdown
Member Author

Side effect: up/down keys change the value and if you close the menu by clicking away, it applies the value to the text instead of cancelling/discarding it. The change should only be applied in 2 cases: 1. User presses Enter in input 2. User clicks/selects a menu item

Updated behavior:

∙ * if input had last interaction, on enter set input value as font size
∙ * else if menu had last interaction (arrow up/down), on enter set focused value as font size

@01zulfi
01zulfi requested a review from thecodrr May 11, 2026 09:18
@thecodrr

Copy link
Copy Markdown
Contributor

Side effect: up/down keys change the value and if you close the menu by clicking away, it applies the value to the text instead of cancelling/discarding it. The change should only be applied in 2 cases: 1. User presses Enter in input 2. User clicks/selects a menu item

Updated behavior:

∙ * if input had last interaction, on enter set input value as font size ∙ * else if menu had last interaction (arrow up/down), on enter set focused value as font size

Not sure if I understand correctly but won't arrow up/down automatically change the input value? Why do we need special handling for both of these cases? Why can't we just handle the Enter as using the input value no matter what?

@01zulfi

01zulfi commented May 12, 2026

Copy link
Copy Markdown
Member Author

Oh my bad, looks like I misunderstood. I thought we should remove the input value changing by navigating the menu with arrow up/down.

I'll bring that back, and set the input value as font size only if the user hits Enter

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>
Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>
* mobile: set default font size 1-400

Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>

* mobile: Use defined font size bounds

Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>

---------

Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>
kashaf-ansari-dev and others added 2 commits July 11, 2026 22:48
Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>
…ont-size-range

Add validation in range input selectors
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.

4 participants