feat(viewer): icon-only "Add comment" selection popover#561
Merged
Conversation
The popover shown when you select text in a doc is now icon-only — the speech-bubble icon, with the visible "Add comment" text dropped — for a more compact affordance. The button is switched to the shared IconButton primitive, which requires an aria-label, so the accessible name "Add comment" is preserved (screen readers and the role+name e2e selectors are unaffected). The floating chrome (shadow-lg) moves onto the button and the Popover wrapper becomes a pure positioner, dropping the hardcoded light/dark colors in favor of IconButton's theme tokens. Also hardens the shared IconButton primitive: it spread props onto a bare <button> defaulting to type="submit"; default it to type="button" (like Button.svelte) so none of its call sites can accidentally submit an enclosing form. Callers can still override. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What
The popover shown when you select text in a doc is now icon-only — the speech-bubble icon, with the visible "Add comment" text dropped — for a more compact affordance.
How
IconButtonprimitive, which requires anaria-label. The accessible name "Add comment" is therefore preserved by construction — screen readers and thegetByRole("button", { name: "Add comment" })e2e selectors are unaffected.shadow-lg) onto the button and turned thePopoverwrapper into a pure positioner, dropping the hardcodedbg-white dark:bg-neutral-700in favor ofIconButton's theme tokens (better dark-mode consistency).IconButton: it spread props onto a bare<button>defaulting totype="submit". Defaulted it totype="button"(matchingButton.svelte) so none of its call sites can accidentally submit an enclosing form. Callers can still override. Added unit tests for the default and the override.Verification
svelte-check: 0 errors;eslint: clean.IconButtonunit tests: 9/9 (2 new).comments.spec.ts,comment-navigation.spec.ts): 48/48, including the anchor-alignment/pending-form positioning tests — no test changes needed.🤖 Generated with Claude Code