Skip to content

Resize Web UI textarea for slight query overflow#105713

Open
itsjoeoui wants to merge 5 commits into
ClickHouse:masterfrom
itsjoeoui:itsjoeoui/105709-play-textarea-hysteresis
Open

Resize Web UI textarea for slight query overflow#105713
itsjoeoui wants to merge 5 commits into
ClickHouse:masterfrom
itsjoeoui:itsjoeoui/105709-play-textarea-hysteresis

Conversation

@itsjoeoui
Copy link
Copy Markdown

Allow the Web SQL UI query editor in play.html to grow when the query is only slightly taller than the current textarea. This keeps small overflows visible while leaving much larger pasted queries scrollable.

Closes #105709

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The Web SQL UI now expands the query editor when a query is at most 30% taller than the current editor height.

Documentation entry:

  • Documentation is not required for this change because the behavior is self-explanatory in the Web SQL UI.

Comment thread programs/server/play.html Outdated
@alexey-milovidov
Copy link
Copy Markdown
Member

Will it activate on page load?

@itsjoeoui
Copy link
Copy Markdown
Author

itsjoeoui commented May 24, 2026

Will it activate on page load?

Ah I missed that, it should be fixed now. 😄

I tested with something like http://127.0.0.1:8123/programs/server/play.html#U0VMRUNUIDAKU0VMRUNUIDEKU0VMRUNUIDIKU0VMRUNUIDMKU0VMRUNUIDQKU0VMRUNUIDUKU0VMRUNUIDYKU0VMRUNUIDcKU0VMRUNUIDgKU0VMRUNUIDk= and it is working.

@alexey-milovidov alexey-milovidov self-assigned this May 24, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label May 24, 2026
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh Bot commented May 24, 2026

Workflow [PR], commit [6ba28e3]

Summary:

job_name test_name status info comment
BuzzHouse (amd_msan) FAIL
MemorySanitizer: use-of-uninitialized-value (STID: None) FAIL cidb

AI Review

Summary

This PR adds resizeQueryAreaIfSlightlyOverflowing to play.html and calls it on editor input and initial query setup so small query overflows expand the textarea while larger queries remain scrollable. I did not find any correctness, safety, or user-facing issue worth an inline comment.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label May 24, 2026
@itsjoeoui itsjoeoui force-pushed the itsjoeoui/105709-play-textarea-hysteresis branch 2 times, most recently from 45c8fb5 to 970681b Compare May 28, 2026 17:50
itsjoeoui added 5 commits May 28, 2026 15:48
The Web UI `play.html` query editor kept its fixed height even when the query was only slightly taller than the visible `textarea`, forcing scrolling for small overflows.

Add `resizeQueryAreaIfSlightlyOverflowing`, which compares the editor required `scrollHeight` with the current height and grows the editor only when the required height is at most 30% larger. Larger pasted queries remain scrollable so the editor does not jump to a large size.

Closes ClickHouse#105709
The `textarea` resize belongs to the query editor input flow, not to `updateQueryParams`, whose job is query parameter and highlighting state.

Move the `resizeQueryAreaIfSlightlyOverflowing` call into the `query_area` `input` listener so the behavior still runs for typing, pasted text, and programmatic changes that dispatch `input`.
Hash restore sets the query before the `input` listener is installed, so moving the resize into the listener alone did not cover initial page load.

Introduce `updateQueryArea` as the shared resize-and-update helper, use it for history restore and the initial query setup path, and leave normal edits wired through the `input` listener.
Keep `updateQueryParams` focused on parameters and highlighting. The textarea resize is now explicit at editor value-change entry points that need it: history restore, input events, and initial page-load setup.

This preserves page-load resizing without introducing a mixed `updateQueryArea` helper.
Restore the previous `input` dispatch calls for history and hash restore. They are not needed for the textarea resize feature, so keep the PR diff focused on the resize helper and the explicit resize calls for input and page-load query setup.
@itsjoeoui itsjoeoui force-pushed the itsjoeoui/105709-play-textarea-hysteresis branch from 970681b to 6ba28e3 Compare May 28, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If the query is only slightly larger than the textarea size in the Web UI (play.html), resize the textarea to fit it.

2 participants