fix: keep audience dropdown open and additive when sharing links#6299
Open
capJavert wants to merge 4 commits into
Open
fix: keep audience dropdown open and additive when sharing links#6299capJavert wants to merge 4 commits into
capJavert wants to merge 4 commits into
Conversation
Clicking an audience row in the Share-a-link composer previously reset the selection to just that item and collapsed the dropdown, forcing a re-open per squad. Make row selection additive (toggle) and preventDefault in onSelect so the menu stays open across selections, matching the checkbox behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…harness The DropdownMenu mock previously rendered content unconditionally and ignored preventDefault, so the "menu stays open" assertions passed even if the menu closed. Teach the mock the Radix contract (content renders only while open; selecting closes unless onSelect calls preventDefault) so the tests actually guard the fix. Drop the redundant stateful flag — always use the stateful harness — and extract openMenu/clickOption helpers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The share/create audience picker is implemented twice. Desktop with the SmartComposer experiment uses AudienceChip (already fixed); mobile/tablet — and anyone with the experiment off — falls back via CreatePostButton to the /squads/create page, which uses MultipleSourceSelect. There, a row click called selectSingleSource and reset the whole selection, so the reported "dropdown resets on every selection" persisted on mobile. Route row clicks through the existing additive toggleSource (matching the checkbox and AudienceChip), and remove the now-dead selectSingleSource. MultipleSourceSelect has pre-existing strict-null violations on unrelated lines (auth user/squad optionality); it is added to the strict migration skip list per the established convention, to be cleaned up separately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On mobile /squads/create the audience picker still closed on each selection. The row was a custom focusable role="button" that called preventDefault/ stopPropagation to drive selection, suppressing the native <label> click that the shared Checkbox already provides. Inside the Radix Popover, that extra focusable element plus the prevented default interferes with the dismissable layer / focus handling and collapses the popover on touch. That custom layer only existed to make row click a single-select (#5057); now that a row is an additive toggle, delete it and let the native <label>/checkbox handle the click. Simpler, accessible (native keyboard toggle), and the popover stays open while selecting. 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
When sharing a link / creating a post on daily.dev, the audience picker (post to "Everyone" plus up to 3 squads) reset the selection on every click, forcing users to re-pick each squad.
The audience picker is implemented twice, split by viewport + experiment:
AudienceChipinsideSmartComposerModal— used on desktop when thefeatureSmartComposerexperiment is on. Its dropdown also collapsed on each click.MultipleSourceSelecton the/squads/createpage — the fallbackCreatePostButtonnavigates to on mobile/tablet (and whenever the experiment is off). Its row click reset the selection to a single item.This PR fixes both so row selection is an additive toggle.
Changes
AudienceChip.tsx: rowonSelectnow callsevent.preventDefault()(keeps the Radix menu open for mouse + keyboard) and routes through the additivetoggleOptioninstead of the replace-selectionselectSingleOption(removed).MultipleSourceSelect.tsx: rowonRowClicknow calls the existing additivetoggleSourceinstead ofselectSingleSource(removed). The popover already stayed open (it has an explicit Done button), so only the reset needed fixing.MultipleSourceSelect.spec.tsxand rewrittenAudienceChip.spec.tsxcover additive add/remove, the 3-squad cap, and (for AudienceChip) the Everyone floor + menu-stays-open contract.AGENTS.md: documents the two-picker split so future audience-UX changes touch both.scripts/typecheck-strict-changed.js:MultipleSourceSelect.tsxadded to the strict skip list — it has pre-existing strict-null violations on unrelated lines (verified identical before/after this change); cleanup deferred per the existing convention.Key decisions
toggleOption/toggleSourcelogic, so the squad cap and floor rules are unchanged.Closes ENG-1818
Created by Huginn 🐦⬛
Preview domain
https://eng-1818-feedback-ux-issue-dropd.preview.app.daily.dev