Skip to content

ENG-1731: Add keyboard-only filtering with tag chips#1072

Open
trangdoan982 wants to merge 2 commits into
eng-1730-add-filter-dropdown-menufrom
eng-1731-add-keyboard-only-filtering-with-tag-chips
Open

ENG-1731: Add keyboard-only filtering with tag chips#1072
trangdoan982 wants to merge 2 commits into
eng-1730-add-filter-dropdown-menufrom
eng-1731-add-keyboard-only-filtering-with-tag-chips

Conversation

@trangdoan982
Copy link
Copy Markdown
Member

@trangdoan982 trangdoan982 commented May 23, 2026

https://www.loom.com/share/dd5b9491a87b436395a5fb2344b51c24

Summary

  • replace the advanced search text input with a keyboard-friendly chip input for node-type filters
  • add ghost completion + Tab commit behavior (prefix-only) and chip keyboard navigation/removal
  • keep chip state synchronized with the existing type filter dropdown and support chips-only result filtering

Test plan

  • Open advanced search in Roam and verify ghost completion appears for unique node-type prefix
  • Press Tab to commit a ghost completion into a chip and confirm search term clears
  • Verify Backspace/Arrow Left-Right chip navigation/removal behavior without mouse
  • Toggle filters via dropdown and confirm chips/results stay in sync

Made with Cursor

Replace the advanced search input with a chip-based type filter input that supports ghost tab-completion and keyboard chip navigation while staying in sync with the dropdown filter state.

Co-authored-by: Cursor <cursoragent@cursor.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 23, 2026

ENG-1731

@supabase
Copy link
Copy Markdown

supabase Bot commented May 23, 2026

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@trangdoan982 trangdoan982 requested a review from mdroidian May 24, 2026 03:26
@mdroidian
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 620c204db8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

nodeTypes={discourseNodes}
onArrowDown={() =>
setActiveIndex((index) =>
Math.min(index + 1, results.length - 1),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard ArrowDown callback when no results

Pressing ArrowDown in the chip input when results.length === 0 (for example, while indexing or after an empty search) computes Math.min(index + 1, -1), which sets activeIndex to -1. If results then appear without another term/filter/sort change, no row is selected and Enter/Cmd+Enter actions silently no-op until the user manually re-navigates. Clamp to a non-negative index or skip updates when there are no results.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

@mdroidian mdroidian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things I noticed with this PR that I think we should address:

Input box alignment
It looks like this PR introduces a misalignment of the search box with the icons. I would consider this a regression that needs to be fixed:

Image

Not using Blueprint Tags
Did we try using Blueprint Tag, TagInput, or InputGroup for this? Were there some issues stopping us from using the components that Roam style guide recommends?

Tailwind
As discussed in our last meeting, we noting how Roam doesn't handle all of the tailwind class syntax: specifically arbitrary values. So let's do a quick run through to double check.

[nodeTypes],
);

const selectedNodeTypes = useMemo(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need a memo?

const [focusedChipIndex, setFocusedChipIndex] = useState(-1);
const chipRefs = useRef<(HTMLSpanElement | null)[]>([]);

const nodeTypeById = useMemo(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need a memo?

[nodeTypes, searchTerm, selectedTypeIds],
);

const completionSuffix = useMemo(() => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need a memo?

</span>
</span>
)}
<input
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use blueprint TagInput or InputGroup for this?

nodeType.canvasSettings?.color ?? "#000000",
)}
>
<span className="max-w-[10rem] truncate leading-4">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Roam handle arbitrary width values?

{nodeType.text}
</span>
<Button
className="!h-4 !min-h-0 !w-4 !min-w-0 !p-0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Roam handle !?

{selectedNodeTypes.map((nodeType, index) => {
const isFocused = focusedChipIndex === index;
return (
<span
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use blueprint tags for this?

<span className="pointer-events-none absolute inset-0 flex items-center overflow-hidden whitespace-nowrap text-sm">
<span className="invisible">{searchTerm}</span>
<span className="text-gray-400">{completionSuffix}</span>
<span className="ml-2 rounded bg-gray-100 px-1 text-[10px] uppercase tracking-wide text-gray-500">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Roam handle text-[arbitrary value]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants