Skip to content

feat(sqllab): add adjustable SQL editor font size - #46636

Open
pdhdol wants to merge 1 commit into
apache:masterfrom
pdhdol:feat/sqllab-editor-font-size
Open

pdhdol wants to merge 1 commit into
apache:masterfrom
pdhdol:feat/sqllab-editor-font-size

Conversation

@pdhdol

@pdhdol pdhdol commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Adds an adjustable font size to the SQL Lab editor, as an accessibility improvement. A new Text size control in the SQL Lab toolbar (next to the share link) lets users make the editor text larger or smaller, or reset it.

  • The size defaults to 12px, moves in steps of 2, and is clamped to 8–32px. The − / + buttons disable at the limits.
  • The choice is persisted in localStorage (sqllab__editor_font_size, registered in LocalStorageKeys) and shared by every open query tab through a small useSyncExternalStore hook, so changing it in one tab updates all of them.
  • Adds an optional fontSize prop to the EditorProps contract in @apache-superset/core and applies it in AceEditorProvider. Because the SQL editor can be replaced by an extension, editors contributed that way can honor the setting too.

The state lives in a hook rather than the Redux store, so the reducers stay free of localStorage side effects. This matches how other SQL Lab preferences (autocomplete, render HTML) are stored.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Default (12px):

sqllab-font-size-12-default

After three clicks on + (18px):

sqllab-font-size-18-larger

TESTING INSTRUCTIONS

  1. Open SQL Lab with at least one query tab.
  2. In the toolbar, use Text size → + and −. The editor font grows or shrinks by 2px per click, and the number between the buttons updates.
  3. Click − until it reaches 8, and + until it reaches 32. The matching button should disable at each limit.
  4. Click Reset. The size returns to 12.
  5. Pick a non-default size and reload the page. The size is kept.
  6. Open a second query tab and change the size there. The first tab's editor follows.

Automated:

  • Jest: npx jest src/SqlLab/components/TextSizeEditor src/SqlLab/components/EditorWrapper src/core/editors (new tests for the control and the hook).
  • Playwright: playwright/tests/sqllab/editor-font-size.spec.ts covers resize, reset, clamping, and persistence across reload.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codeant-ai-for-open-source

codeant-ai-for-open-source Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: d8e677076d4d

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.42%. Comparing base (7a46732) to head (d8e6770).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #46636   +/-   ##
=======================================
  Coverage   86.42%   86.42%           
=======================================
  Files        3183     3186    +3     
  Lines      222605   222648   +43     
  Branches    52996    53006   +10     
=======================================
+ Hits       192377   192418   +41     
- Misses      26758    26760    +2     
  Partials     3470     3470           
Flag Coverage Δ
javascript 83.41% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Add a "Font size" control to the SQL Lab toolbar that increases,
decreases, or resets the SQL editor font size.

- The size defaults to 12px, moves in steps of 2, and is clamped to 8-32px.
  The +/- buttons disable at the limits.
- The choice is persisted in localStorage (sqllab__editor_font_size) and
  shared by every open query tab through a small useSyncExternalStore hook,
  so changing it in one tab updates all of them.
- Add an optional `fontSize` prop to the editor `EditorProps` contract in
  @apache-superset/core and apply it in AceEditorProvider, so editors
  contributed by extensions can honor it as well.
- The control reuses existing translatable strings ("Font size",
  "Increase", "Decrease", "Reset"), so no new messages.pot entries are
  needed.

Includes Jest tests for the control and the hook, and a Playwright spec
covering resize, reset, clamping, and persistence across reload.
@pdhdol
pdhdol force-pushed the feat/sqllab-editor-font-size branch from afdb9ec to d8e6770 Compare November 29, 2026 14:16

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant