Skip to content

Fix Change Method Signature editable cells not rendering typed text (#4417)#4448

Closed
wenytang-ms wants to merge 1 commit into
redhat-developer:mainfrom
wenytang-ms:fix/change-signature-editable-cell-4417
Closed

Fix Change Method Signature editable cells not rendering typed text (#4417)#4448
wenytang-ms wants to merge 1 commit into
redhat-developer:mainfrom
wenytang-ms:fix/change-signature-editable-cell-4417

Conversation

@wenytang-ms

Copy link
Copy Markdown
Contributor

Fixes #4417

Problem

On Change Method Signature, editing a parameter Type (or Name / Default value, or an exception Type) shows nothing while typing, and on OK the typed text is appended to the original value instead of replacing it (e.g. String + int -> Stringint).

Root cause: these cells set contentEditable directly on the deprecated @vscode/webview-ui-toolkit vscode-data-grid-cell. That component's shadow root is only <template shadowrootmode=""open""><slot></slot></template>, so the text node typed onto the host sits outside any slot and is never rendered. On commit the value was read via outerText, which concatenates the original type with the stray text node — explaining both the invisible-while-typing and append-on-commit behavior. Reproduces with --disable-gpu (not a compositing issue).

Fix

Render a real <input> as slotted content of the cell while editing, and read its .value on commit instead of outerText:

  • Typed text is now visibly rendered.
  • Commit uses correct replace semantics.
  • focus()/select() moved into the setState callback (the input mounts after re-render); entering edit selects the existing text for quick replacement.
  • Removed the now-obsolete contentEditable DOM-reset on cancel — component state is the single source of truth.

This is a minimal, dependency-free fix scoped to the editable cells. Fully migrating the dialog off the archived toolkit (it is the only webview still using it) can be tracked separately.

Testing

  • npx tsc --noEmit — passes
  • eslint on the changed file — clean
  • webpack changeSignature bundle — builds successfully
  • Manual VS Code UI verification of the dialog still recommended by a reviewer.

…edhat-developer#4417)

The parameter Type/Name/Default and exception Type cells relied on contentEditable directly on the deprecated webview-ui-toolkit �scode-data-grid-cell. The cell's shadow root only contains a <slot>, so text typed onto the host text node is never slotted/rendered: the field looks blank while editing, and on commit the typed text was read via outerText and appended to the original value instead of replacing it.

Render a real <input> as slotted content of the cell when editing, and read the value via .value. This makes typed text visible and gives correct replace-on-commit semantics. Focus/select now run in the setState callback since the input mounts after re-render, and the obsolete contentEditable DOM-reset on cancel is removed.
@wenytang-ms wenytang-ms force-pushed the fix/change-signature-editable-cell-4417 branch from 5b294a2 to 0bdfe70 Compare June 30, 2026 06:12
@wenytang-ms

Copy link
Copy Markdown
Contributor Author

current behavior

beforefix.mp4

fixed

afterfix.mp4

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.

Change Method Signature: parameter Type field doesn't visibly render typed text (contenteditable text node escapes shadow DOM slot)

1 participant