Fix Enterprise URL Entry Box#100
Merged
pol-rivero merged 2 commits intopol-rivero:mainfrom Mar 24, 2026
Merged
Conversation
added 2 commits
March 23, 2026 14:31
…Add missing value prop to the TextBox in EnterpriseServerEntry so the displayed text stays in sync with component state.
Author
Author
|
My first commit also fixed it, fwiw, but it seemed better to touch code that was exclusive to this repo. Up to you though. |
Owner
|
Works like a charm, thanks!
Absolutely, it's always better to minimize the diff with the upstream. |
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.

Summary
Fixes a bug where text typed into the "Enterprise or AE address" TextBox on the GitHub Enterprise sign-in page appears reversed (e.g. typing "https" displays "sptth").
Root Cause
This bug is caused by an interaction between the IME composition handling added in
da0f1a10("Handle IME composition in text input components") and TextBox consumers that don't pass avalueprop.The IME changes added:
cursorPositiontracking inTextBoxstatecomponentDidUpdatethat callssetSelectionRange()to restore cursor position, clamping to(this.state.value ?? '').lengthThe problem occurs in
componentWillReceiveProps:When a parent component (like
EnterpriseServerEntry) does not pass avalueprop,nextProps.valueisundefined. After each keystroke:onChangefires → setsstate.value = 'h',cursorPosition = {start: 1, end: 1}onValueChangedcallback triggers parent re-rendervalueprop)componentWillReceiveProps:this.state.value('h') !==nextProps.value(undefined) → resetsstate.valuetoundefinedcomponentDidUpdate:max = (undefined ?? '').length = 0→safeStart = Math.min(1, 0) = 0→setSelectionRange(0, 0)→ cursor jumps to position 0This wasn't an issue before the IME changes because there was no
componentDidUpdatereadingstate.valueto position the cursor. The upstreamdesktop/desktoprepo is also unaffected since it doesn't have the IME composition handling.Fix
Add an
undefinedguard incomponentWillReceiveProps:This prevents
state.valuefrom being reset toundefinedwhen the parent simply doesn't pass avalueprop, which means the cursor position clamping incomponentDidUpdateuses the correct string length. This protects all uncontrolled TextBox consumers, not just the enterprise entry form.