patternfly / patternfly/patternfly-react

Menu/MenuItem - should support drill-[up/out] icon/layout in menu list

未關閉
#9,653 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

PF Team Pinned
主要語言
TypeScript
星號
862
分支
392
平均合併
4 天 8 小時
30 天內合併 PR
9

描述

re: https://github.com/patternfly/patternfly-react/issues/9587 and this issue to make the same update in core https://github.com/patternfly/patternfly/issues/5950. Not sure if this is a breaking change or not, probably depends on how we go about implementing it.

In the drilldown with breadcrumb menu examples, in the breadcrumb dropdown, we have items that present (and seem to function) as drill-[up/out] items with a back arrow at the start of the item, and clicking on the item takes you up a level in the breadcrumb hierarchy. However, our component doesn't support this layout - our examples are using a user-supplied icon passed as the icon prop - https://github.com/patternfly/patternfly-react/blob/e27aac2f35e0a8bb16fa5397eb5ef841b3ecc578/packages/react-core/src/components/Menu/examples/MenuWithDrilldownBreadcrumbs.tsx#L130-L138

Some issues with this are:

  1. It doesn't work by default in RTL since we can't predictably target and mirror/flip that menu item icon for the user since that could be a non-directional icon or they may have opted for some other type of directional icon there that shouldn't be flipped.
  2. Since it's a user supplied icon, there is the possibility for inconsistency
  3. I could be wrong, but I don't know if a user could pass an actual icon to any of those items since the prop is being used for the back arrow.

We have a direction="up" prop that puts the correct icon container and icon on a drill-up/out icon and works in RTL, but that is specific to the top/first item in a drilled-in drilldown menu. The prop applies other logic to that item that isn't appropriate for use in the breadcrumb items, so we can't use that prop there. https://github.com/patternfly/patternfly-react/blob/e27aac2f35e0a8bb16fa5397eb5ef841b3ecc578/packages/react-core/src/components/Menu/MenuItem.tsx#L366-L370

Ideally we could do something like update the direction prop so it could be used in these breadcrumb menu items or maybe introduce some new kind of prop for an item that indicates clicking it does some kind of "back" action and it just borrows the way direction="up" includes the icon in the item.


Jira Issue: PF-116

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 packages/react-core/src/components/Menu/MenuItem.tsx 開始,特別查看現有的 direction="up" 處理,以及 issue 中連結的 MenuWithDrilldownBreadcrumbs.tsx 範例。將目前的 breadcrumb dropdown 行為與 core issue 和 RTL 預期進行比較。完成的標準是:breadcrumb drill-up/out 項目具有一致且適應方向的版面配置,不依賴使用者提供的返回圖示。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
react, typescript
領域
frontend
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。