Wrap long ScVal byte values so they don't overflow on mobile#13
Open
Signor1 wants to merge 1 commit into
Open
Conversation
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.
Closes #12
I hit this testing a passkey smart wallet on my phone. Opening a contract-creation tx on stellar.expert made the whole page scroll sideways. The culprit is the
__constructorargs: one of them is a long base64bytesvalue (the wallet's public key) with no spaces to wrap on.In
ScVal, thebytescase renders into<span className="condensed">, which only sets letter-spacing and there's nothing telling it it can break. The other long-value cases (str,sym,instance) already useword-break. And because the op row isdisplay: flex; flex-wrap: nowrap, that one unbreakable token keeps the row from shrinking, so it runs off the edge and drags the page with it.The fix is one line on
.sc-val:overflow-wrap: anywhere. I went withanywhererather thanbreak-wordon purpose. It actually shrinks the element's min-content width, which is what lets the no-wrap flex row collapse back to the viewport. It inherits down to the byte/error spans, only kicks in when a token would otherwise overflow, and leaves short values looking exactly as they did. No JSX changes needed.To check it, I reproduced the op row at a 375px width: it stretched the page to 688px before the change and sat at 375px (no overflow) after.