adobe / spectrum-web-components

Spectrum Web Components
https://opensource.adobe.com/spectrum-web-components/
Apache License 2.0
1.28k stars 204 forks source link

[Feat]: sp-menu component to provide support for virtualizing sp-menu-item #3213

Open monkeyjabs opened 1 year ago

monkeyjabs commented 1 year ago

Code of conduct

Impacted component(s)

sp-menu, sp-menu-item

Description of the requested feature

For a large menu list using the sp-menu we would like to be able to virtualized the sp-menu-item for performance gain. While this does partially work right out the box, there is a problem with tab navigation. Once the focus is set into the menu item, using the arrow key to navigate can only navigate to a subset of the list.

Here is an example: https://studio.webcomponents.dev/edit/oPXMxECYa2Hl67I0mEG4/src/index.ts?branch=swc-menu-virtualizer%40x6l1txiIKneNlFAZY2ShSrq382h2&p=stories

Mockups or screenshots

No response

Implementation notes or ideas

No response

Westbrook commented 1 year ago

Some off the cuff thought:

Excited to dig further into this convo!

monkeyjabs commented 1 year ago

The main reason that we're exploring this approach is from a performance analysis from Google Lighthouse, one of the area that gave us low score. PixelSnap 2023-05-18 at 13 56 18@2x

I have not explored the virtualize directive yet, that was my next thing to explore. As for <sp-grid> and <sp-table> element I'm not sure if it it will our design.

PixelSnap 2023-05-18 at 14 13 56

One of the main reasons to use SWC is to get the accessibility features right out of the box, so we definitely want to avoid having to handle the accessibilities ourselves.

monkeyjabs commented 1 year ago

virtualize directive yield with the same result as the virtualizer element: https://studio.webcomponents.dev/edit/collection/P69Fy1cWB7KlLVvStVRK/5X38x8tuk5qh22qcPGri/src/index.ts?p=stories

najikahalsema commented 6 months ago

Blocked by https://github.com/adobe/spectrum-web-components/issues/4101