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.
Hey there 👋 I would like to propose this as an alternative to #5155 and #5117.
Instead of hiding the domain-like structure of the AT Protocol handles, or special-casing
bsky.social
or other “well-known” suffixes, this PR aims to make handles more glanceable, and to help users eventually build an intuition about the structure/role of handles in a decentralized social network. It also aims to make at least a subset of domain spoofing attempts (malicious or not) obvious to the user.Storybook
How it works
We introduce a new
HighlightedHandle
component, that only rendersText
elements, and can therefore be used as a drop-in solution almost anywheresanitizeHandle()
is currently used. This component uses straightforward rules to split a handle into up to three parts: a prefix, a suffix, and a spoof, and applies syntax highlighting. Thetldts
module is added as a new dependency and is used, along with the existingtlds
module, to help with the splitting.Splitting Rules
.com
,.co.uk
,.mg.gov.br
) are entirely comprised of the prefix, with no suffix.What this (hopefully) teaches users
Screenshots
Prior Art
This very much like the URL syntax highlighting provided by web browsers, but with the reverse “focus” on the subdomain instead of the domain part, and a different treatment of public/private domains.
Questions
Do we want to consider non-ICANN but otherwise “public” domains (e.g.
.github.io
,vercel.app
) just like their ICANN counterparts? This is supported bytldts
, we just need to set theallowPrivateDomains
option totrue
. Might be more “technically consistent” with how DNS verification is set up, and potentially more inclusive to users on free webhosts who can't afford domains... But feels “weird” and might be confusing to users, who might not understand why these specific handles are not highlighted.