Repository navigation
feat: enable menu visibility in TaggableSelect component - #129
Conversation
WalkthroughRemoved the forced portaling in TaggableSelect by commenting out Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant TaggableSelect
participant CreatableSelect
participant Menu
User->>TaggableSelect: Focus / Type
TaggableSelect->>CreatableSelect: render({ /* menuPortalTarget commented out */ })
CreatableSelect->>Menu: Mount according to default/consumer target (inline or portal)
User->>Menu: Click option / create
Menu-->>CreatableSelect: Selection event
CreatableSelect-->>TaggableSelect: onChange(value)
TaggableSelect-->>User: Updated tags displayed
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip
8000
👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/TaggableSelect.tsx (1)
10-24: Export props type and build on publicRS_CreatablePropsGuidelines: export TS prop types and use named exports. Also stop composing from internal types.
-type CreatableProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = StateManagerProps< - Option, - IsMulti, - Group -> & - CreatableAdditionalProps<Option, Group> & {-label?: string; - id?: string; - className?: string; - errors?: string[]; - helpText?: string; - required?: boolean; - disabled?: boolean; - placeholder?: string; - }; +export type TaggableSelectProps< + Option, + IsMulti extends boolean, + Group extends GroupBase<Option> +> = RS_CreatableProps<Option, IsMulti, Group> & { + label?: string; + id?: string; + className?: string; + errors?: string[]; + helpText?: string; + required?: boolean; + disabled?: boolean; + placeholder?: string; +};And update the component signature accordingly (next comment).
🧹 Nitpick comments (7)
src/components/TaggableSelect.tsx (7)
66-68: Default-open behavior: confirm intent; adjust prop order if you want to force itPlacing
menuIsOpenbefore{...props}makes “always open” the default but still allows callers to override viaprops.menuIsOpen. If you intend to force-open regardless of caller input, move it after the spread. Also consider not opening when disabled.Option A — force-open (un‑overridable):
- <CreatableSelect - menuIsOpen - {...props} + <CreatableSelect + {...props} + menuIsOpenOption B — default-open, but closed when disabled:
- menuIsOpen + menuIsOpen={!props.disabled && (props.menuIsOpen ?? true)}
69-71: Portal disabled: check clipping/stacking; alignmenuPositionandstylesWith the portal commented out, the menu may be clipped by overflowed parents and the
styles.menuPortalblock won’t apply. Either re-enable the portal (and switch tomenuPosition="fixed") or remove the now-unusedmenuPortalstyle.Option 1 — re-enable portal:
- // menuPortalTarget={document.body} - menuPosition="absolute" + menuPortalTarget={document.body} + menuPosition="fixed"
130-133:styles.menuPortalis unused without a portalThis block no longer applies when the portal is disabled; remove to avoid confusion.
- menuPortal: (base) => ({ - ...base, - zIndex: 9999, - }),
2-3: Avoid deep imports fromnode_modules; use public react-select typesDeep paths are unstable and can break on minor upgrades. Prefer public exports from
react-select/creatable.-import { CreatableAdditionalProps } from 'node_modules/react-select/dist/declarations/src/useCreatable'; -import { StateManagerProps } from 'node_modules/react-select/dist/declarations/src/useStateManager'; +import type { CreatableProps as RS_CreatableProps } from 'react-select/creatable';Then replace the local props alias to build on the public type and export it (see next diff).
26-28: Align component signature with exported props typeRename to use the exported
TaggableSelectPropstype.-const TaggableSelect = <Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>( - props: CreatableProps<Option, IsMulti, Group> +const TaggableSelect = < + Option, + IsMulti extends boolean = false, + Group extends GroupBase<Option> = GroupBase<Option> +>( + props: TaggableSelectProps<Option, IsMulti, Group> )
29-29: Use ReactuseIdfor SSR‑safe, stable ids
Math.random()can cause hydration mismatches. PreferuseId().+import { useId } from 'react'; ... - const id = props.id || Math.random().toString(); + const autoId = useId(); + const id = props.id ?? autoId;
168-168: Add a named export per guidelinesKeep default export for backward compatibility and add a named export now; deprecate default later.
export default TaggableSelect; +export { TaggableSelect };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/TaggableSelect.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/{components,utils}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/{components,utils}/**/*.{ts,tsx}: Use TypeScript for all components and utilities
Use named exports for components and utilities
Files:
src/components/TaggableSelect.tsx
src/components/**/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/components/**/*.tsx: Use functional React components and hooks for all components
Use Tailwind CSS utility classes for component styling
Define and export TypeScript prop types/interfaces for each component
Files:
src/components/TaggableSelect.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use@as an alias forsrc/in imports
UsedebounceSearchfor debounced async search interactions
Files:
src/components/TaggableSelect.tsx
src/components/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place new components at src/components/ComponentName.tsx
Files:
src/components/TaggableSelect.tsx
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (7)
src/components/AsyncSearchableSelect.tsx (2)
71-85: Color token migration to var(--color-*) looks good.Minor inconsistency with TaggableSelect: neutral30 maps to gray-300 here but gray-200 there. Consider unifying to avoid subtle UI drift across components.
63-66: Props precedence: {...props} last overrides theme/styles/className.This differs from TaggableSelect (which spreads props first). Recommend standardizing so defaults aren’t accidentally clobbered. Move the spread earlier.
Apply:
- <AsyncSelect - inputId={id} + <AsyncSelect + {...props} + inputId={id} isDisabled={props.disabled} className={twMerge('shadow-sm', props.className, props.disabled && 'rounded border', hasError && 'hasErrors')} placeholder={<div className="text-sm text-gray-400">{props.placeholder || 'Search...'}</div>} theme={(theme) => ({ ...theme, colors: { ...theme.colors, primary: 'var(--color-primary-500)', primary75: 'var(--color-primary-200)', primary50: 'var(--color-primary-100)', primary25: 'var(--color-primary-50)', neutral5: 'var(--color-gray-100)', neutral10: 'var(--color-gray-100)', neutral20: 'var(--color-gray-200)', neutral30: 'var(--color-gray-300)', neutral40: 'var(--color-gray-400)', neutral50: 'var(--color-gray-500)', neutral60: 'var(--color-gray-600)', neutral70: 'var(--color-gray-700)', neutral80: 'var(--color-gray-800)', neutral90: 'var(--color-gray-900)', }, })} ... menuPortalTarget={props.menuPortalTarget} menuPosition={props.menuPosition} - {...props} />Also applies to: 152-155
src/components/TaggableSelect.tsx (5)
66-71: Removing forced portaling — good. Allow menuPosition override.Keep default absolute, but let consumers opt into 'fixed' when needed.
- // menuPortalTarget={document.body} - menuPosition="absolute" + // menuPortalTarget={document.body} + menuPosition={props.menuPosition ?? 'absolute'}
139-158: Normalize theme neutrals across components.neutral30 is gray-200 here but gray-300 in AsyncSearchableSelect. Pick one for consistency (suggest gray-300).
colors: { ...theme.colors, primary: 'var(--color-primary-500)', primary75: 'var(--color-primary-200)', primary50: 'var(--color-primary-100)', primary25: 'var(--color-primary-50)', neutral5: 'var(--color-gray-100)', neutral10: 'var(--color-gray-100)', neutral20: 'var(--color-gray-200)', - neutral30: 'var(--color-gray-200)', + neutral30: 'var(--color-gray-300)', neutral40: 'var(--color-gray-400)', neutral50: 'var(--color-gray-500)', neutral60: 'var(--color-gray-600)', neutral70: 'var(--color-gray-700)', neutral80: 'var(--color-gray-800)', neutral90: 'var(--color-gray-900)', },
10-24: Export the prop type to align with guidelines.Guideline: “Define and export TS prop types for each component.”
-type CreatableProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = StateManagerProps< +export type CreatableProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = StateManagerProps< Option, IsMulti, Group > & CreatableAdditionalProps<Option, Group> & { label?: string; id?: string; className?: string; errors?: string[]; helpText?: string; required?: boolean; disabled?: boolean; placeholder?: string; };
2-3: Avoid deep imports from node_modules for types.Import public types from react-select to reduce breakage risk on library upgrades. Consider switching in a follow-up; I can help draft it.
1-168: Optional: prefer named exports for components (breaking change).Repo guideline prefers named exports; consider in a separate PR to avoid API break.
Would you like me to open a follow-up PR that converts default exports to named and updates imports across the repo?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/AsyncSearchableSelect.tsx(3 hunks)src/components/TaggableSelect.tsx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/{components,utils}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/{components,utils}/**/*.{ts,tsx}: Use TypeScript for all components and utilities
Use named exports for components and utilities
Files:
src/components/AsyncSearchableSelect.tsxsrc/components/TaggableSelect.tsx
src/components/**/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/components/**/*.tsx: Use functional React components and hooks for all components
Use Tailwind CSS utility classes for component styling
Define and export TypeScript prop types/interfaces for each component
Files:
src/components/AsyncSearchableSelect.tsxsrc/components/TaggableSelect.tsx
src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/**/*.{ts,tsx}: Use@as an alias forsrc/in imports
UsedebounceSearchfor debounced async search interactions
Files:
src/components/AsyncSearchableSelect.tsxsrc/components/TaggableSelect.tsx
src/components/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place new components at src/components/ComponentName.tsx
Files:
src/components/AsyncSearchableSelect.tsxsrc/components/TaggableSelect.tsx
🧠 Learnings (2)
📚 Learning: 2025-09-04T09:20:19.197Z
Learnt from: CR
PR: getdokan/dokan-ui#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-04T09:20:19.197Z
Learning: Applies to src/utils/index.ts : Define theme colors in src/utils/index.ts as `themeColors`
Applied to files:
src/components/AsyncSearchableSelect.tsxsrc/components/TaggableSelect.tsx
📚 Learning: 2025-09-04T09:20:19.197Z
Learnt from: CR
PR: getdokan/dokan-ui#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-04T09:20:19.197Z
Learning: Applies to tailwind.config.ts : Extend Tailwind colors using `extendedThemeColorsUsingVariables`
Applied to files:
src/components/AsyncSearchableSelect.tsx
🔇 Additional comments (5)
src/components/AsyncSearchableSelect.tsx (2)
121-136: Updated multiValue tokens — LGTM.The var(--color-primary-*) substitutions are correct and consistent.
137-141: Text color to gray-800 — verify contrast in all themes.If a dark theme or non-white surfaces exist, confirm readability of loading/no-options messages.
Also applies to: 146-151
src/components/TaggableSelect.tsx (3)
113-128: multiValue token migration — LGTM.
133-138: noOptionsMessage color var — LGTM.
113-138: Verify color variable availability.
Automated verification failed (rg/tailwind.config.* not found). Confirm the CSS variables used in src/components/TaggableSelect.tsx (≈lines 11 8000 3–158) and src/components/AsyncSearchableSelect.tsx—var(--color-primary-50), var(--color-primary-100), var(--color-primary-600), var(--color-gray-800)—are defined in your theme/Tailwind (tailwind.config.* or src/utils/themeColors) or add safe fallbacks.
Summary by CodeRabbit
Bug Fixes
Style
Chores