Autocomplete does not filter a Tree

オープン
#10,664 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

Start by comparing Tree.mjs with GridList.mjs and the other components that consume SelectableCollectionContext under react-aria-components/dist/private/. Verify the existing Autocomplete example with ListBox, then make the tree filter matching rows while retaining their ancestors; the reproduced tree and list behavior should agree when typing “ban”.

索引モデルが issue の本文から書いたものです。

説明

Autocomplete
Provide a general summary of the feature here

Let Autocomplete filter a Tree, as it filters ListBox, Menu and GridList.

🤔 Expected Behavior?

Typing into an Autocomplete's SearchField filters the rows of a Tree inside it.

😯 Current Behavior

The tree is not filtered. react-aria-components 1.21.1, Chromium, typing ban into each field of the example below:

typed 'ban': tree rows Apple/Banana/Cherry | listbox options Banana

SelectableCollectionContext is read by Autocomplete.mjs, GridList.mjs, ListBox.mjs, Menu.mjs, Table.mjs and TagGroup.mjs under react-aria-components/dist/private/; Tree.mjs does not reference it.

💁 Possible Solution

Have Tree consume SelectableCollectionContext as GridList does, filtering child rows and keeping the ancestors of a matching row.

🔦 Context

A searchable tree select in our design system. Today the caller has to filter the rows itself, while the listbox equivalent filters locally.

💻 Examples
import { Autocomplete, Input, ListBox, ListBoxItem, SearchField, Tree, TreeItem, TreeItemContent, useFilter } from "react-aria-components";

export function Repro() {
  const { contains } = useFilter({ sensitivity: "base" });
  const fruits = ["Apple", "Banana", "Cherry"];
  return (
    <>
      <Autocomplete filter={contains}>
        <SearchField aria-label="tree search"><Input /></SearchField>
        <Tree aria-label="tree">
          {fruits.map((f) => <TreeItem key={f} id={f} textValue={f}><TreeItemContent>{f}</TreeItemContent></TreeItem>)}
        </Tree>
      </Autocomplete>
      <Autocomplete filter={contains}>
        <SearchField aria-label="list search"><Input /></SearchField>
        <ListBox aria-label="list">{fruits.map((f) => <ListBoxItem key={f} id={f}>{f}</ListBoxItem>)}</ListBox>
      </Autocomplete>
    </>
  );
}
🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

主要言語
TypeScript
スター
16k
フォーク
1.6k
平均マージ
3日 19時間
マージ済み PR(30日)
46

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

adobe/react-spectrum のほかの issue

adobe/react-spectrum の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。