getInteractiveLegendEvents onLegendClick not called with ChartBar in ChartStack + ChartAxis
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
getInteractiveLegendEvents と、ChartBar、ChartStack または ChartGroup、および ChartAxis で使用される Chart のイベントディスパッチパスから始めます。最小限の例を再現し、動作する ChartArea およびラップされていない ChartBar のケースと比較してから、ChartAxis が存在する場合に両方の wrapper type で onLegendClick が発火することを確認します。
索引モデルが issue の本文から書いたものです。
説明
Description
getInteractiveLegendEvents's onLegendClick callback is never invoked when ChartBar components are wrapped in ChartStack (or ChartGroup) alongside ChartAxis. The same setup with ChartArea instead of ChartBar works correctly.
Steps to reproduce
- Create a
ChartwithChartAxis,ChartBarinside aChartStack, and aChartLegend - Pass
getInteractiveLegendEvents({ chartNames, legendName, onLegendClick })to Chart'seventsprop - Click a legend item
onLegendClickis never called
Minimal reproduction
<Chart
events={getInteractiveLegendEvents({
chartNames: [['bar-0'], ['bar-1'], ['bar-2']],
isHidden,
legendName: 'legend',
onLegendClick: handleLegendClick,
})}
legendComponent={<ChartLegend name="legend" data={legendData} />}
containerComponent={<ChartContainer />}
>
<ChartAxis />
<ChartAxis dependentAxis />
<ChartStack>
<ChartBar name="bar-0" data={data[0]} />
<ChartBar name="bar-1" data={data[1]} />
<ChartBar name="bar-2" data={data[2]} />
</ChartStack>
</Chart>
Full repro: https://github.com/sachaudh/pf-legend-click-repro
What works vs what doesn't
| Setup | onLegendClick fires? |
|---|---|
| ChartArea + ChartStack + ChartAxis | Yes |
| ChartBar + ChartAxis (no wrapper) | Yes |
| ChartBar + ChartStack (no ChartAxis) | Yes |
| ChartBar + ChartStack + ChartAxis | No |
| ChartBar + ChartGroup + ChartAxis | No |
All three ingredients are required to trigger the bug: ChartBar, a ChartStack/ChartGroup wrapper, and ChartAxis.
Workaround
Apply click events directly to ChartLegend's events prop instead of relying on Chart-level event dispatch:
const legendClickEvents = [
{ target: 'data', eventHandlers: { onClick: handleClick } },
{ target: 'labels', eventHandlers: { onClick: handleClick } },
];
<ChartLegend name="legend" data={legendData} events={legendClickEvents} />
Affected version
@patternfly/react-charts v8.4.1, Victory v37.3.6
Jira Issue: PF-3666
- 主要言語
- TypeScript
- スター
- 862
- フォーク
- 392
- 平均マージ
- 4日 8時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
patternfly/patternfly-react のほかの issue
-
PF Team
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
patternfly/patternfly-react#12651 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
patternfly/patternfly-react#12637 ·
-
PF Team
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
patternfly/patternfly-react#12617 · コメント 1 件 ·
-
PF Team
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
patternfly/patternfly-react#12610 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
patternfly/patternfly-react#12600 ·
patternfly/patternfly-react の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug v2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/inspector#2458 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
carbon-design-system/ibm-products#9907 ·