feat(shell): a nav item with a URL is a real link - #33
Merged
Conversation
The rail rendered every item as <button onClick={onSelect}>. That navigates and
throws away everything the browser gives an anchor for free: cmd-click and
middle-click into a second tab, the context menu's "open in new tab" and "copy
link address", and a link announced as a link rather than a button that happens
to move you.
An operator watching a journal in one tab while editing in another is the
ordinary case in a console, so it is not a small loss. Mockifyr's rail is
NavLink today and M4 would have downgraded it.
onSelect still fires, so a router preventDefaults and pushes state as before.
Without href the item is still a button with the same classes — the class string
is shared between both elements deliberately, so whether an item navigates is
never a visual question. The visual gate proves it: not one baseline moved.
Refs qorpe/mockifyr#323.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The fifth and last gap qorpe/mockifyr#323 is blocked on.
The rail renders every item as
<button onClick={item.onSelect}>. That navigates, and throws away everything the browser gives an anchor for free:An operator watching a journal in one tab while editing stubs in another is the ordinary case in a console, so this is not a small loss. Mockifyr's rail is
NavLinktoday, and M4 would have downgraded it — trading ~690 lines of duplication for navigation you cannot open twice is a bad trade.onSelectstill fires on click, so a routerpreventDefaults and pushes state exactly as before.Nothing existing changes
Without
hrefthe item is still a button. The class string is shared between both elements deliberately — whether an item navigates should never be a visual question — and the tests assert that an inactive link and an inactive button carry byte-identical classes.The visual gate is the proof: not one of the 63 baselines moved. The gallery demo now renders one item as a link, and the rendering is pixel-identical.
Gates
One test premise of mine was wrong on the way and worth recording: I first compared a link against a button while the link was the active item, so the classes differed for a legitimate reason. The implementation was right; the comparison was not.