docs(NetworkSwitcher): document Alt+N shortcut + persistence behavior (#342) + assert tooltip advertises it - #388
Merged
k-deejah merged 1 commit intoJul 29, 2026
Conversation
…Sorokit#342) + assert tooltip advertises it Issue Sorokit#342 lists three gaps that are already implemented in source and verify what is already covered by the existing Sorokit#353+ test suite (Alt+N keyboard shortcut, mismatch badge, persistence): - `NETWORK_SWITCHER_SHORTCUT = \"Alt+N\"` is already wired to a `keydown` listener and `aria-keyshortcuts` on the trigger button. - The mismatch badge computes `network.name !== initialNetwork.name` and a warning `<div role=\"alert\">` inside the dropdown. - Persistence is implemented in `SorokitProvider.switchNetwork` which writes `localStorage[\"sorokit_network\"]` and `SorokitProvider` restores it on mount via `client.network.switchNetwork(savedNet)`. This commit does the following refinements on top: 1. The exported `NETWORK_SWITCHER_SHORTCUT` constant now carries a JSDoc explaining that it (a) toggles the picker via a global keydown listener, (b) is mirrored in `aria-keyshortcuts` for accessibility, and (c) the selected network persists across reloads through `SorokitProvider`. Previously the constant was a bare string with no documentation. 2. A new test in `describe(\"Alt+N keyboard shortcut\")` asserts that the trigger-tooltip text contains `/Press Alt\\+N to switch networks/i` so the shortcut stays advertised to assistive tech. The tooltip was rendering the message in source but no test guarded the wording. No changes to runtime behavior; one new export-side docstring + one new test. Closes Sorokit#342
|
@oladev2026-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Issue #342’s three flagged gaps already ship in source:
NETWORK_SWITCHER_SHORTCUT = "Alt+N"toggles the picker through akeydownlistener and is mirrored in the trigger button’saria-keyshortcutsattribute.data-testid="network-mismatch-badge") appears whennetwork.name !== initialNetwork.nameand an in-dropdownrole="alert"explains the difference.SorokitProvider.switchNetworkwriteslocalStorage["sorokit_network"], andSorokitProviderrestores it on next mount viaclient.network.switchNetwork(savedNet)(covered by thenetwork persistencedescribe block inSorokitProvider.test.tsx).This refactor:
NETWORK_SWITCHER_SHORTCUTconstant so it advertises the keyboard shortcut implementation and the persistence expectation to anyone reading the type system.describe("Alt+N keyboard shortcut")that the trigger tooltip text contains the shortcut (/Press Alt\+N to switch networks/i).No runtime changes. No existing tests modified.
Notes
Tooltip.Portalwhich is mocked to wrap-as-fragment in the test environment, so the helper assertion queries a DOM node that is present at first paint.Alt+N; the JSDoc only documents intent, not the keymap.NETWORK_SWITCHER_SHORTCUTkeeps getting the same string value.Closes #342