Fix Change Method Signature editable cells not rendering typed text (#4417)#4448
Closed
wenytang-ms wants to merge 1 commit into
Closed
Conversation
…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.
5b294a2 to
0bdfe70
Compare
Contributor
Author
|
current behavior beforefix.mp4fixed afterfix.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
contentEditabledirectly on the deprecated@vscode/webview-ui-toolkitvscode-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 viaouterText, 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.valueon commit instead ofouterText:focus()/select()moved into thesetStatecallback (the input mounts after re-render); entering edit selects the existing text for quick replacement.contentEditableDOM-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— passeseslinton the changed file — cleanchangeSignaturebundle — builds successfully