base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[menu][select][composite] Skip `display: none` items

Open atomiks opened this issue 6 months ago • 6 comments

Fixes #1903

atomiks avatar May 13 '25 04:05 atomiks

Open in StackBlitz

npm i https://pkg.pr.new/@base-ui-components/react@1907

commit: 09235fe

pkg-pr-new[bot] avatar May 13 '25 04:05 pkg-pr-new[bot]

Deploy Preview for base-ui ready!

Name Link
Latest commit 677ada22dceea46a96510c6fc870f8b8d263b1f9
Latest deploy log https://app.netlify.com/sites/base-ui/deploys/6822c75cfcf53a00091e9a23
Deploy Preview https://deploy-preview-1907--base-ui.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar May 13 '25 04:05 netlify[bot]

Deploy Preview for base-ui ready!

Name Link
Latest commit 09235fe932ada9371675debbdc91c21269ef7718
Latest deploy log https://app.netlify.com/projects/base-ui/deploys/685164e72f2b900008ad265c
Deploy Preview https://deploy-preview-1907--base-ui.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar May 13 '25 04:05 netlify[bot]

@mj12albert @romgrk

This was my concern as well (more than the "amount" of the perf cost), that everyone will pay this cost for a pretty specific use-case

This only checks 3 items: the first item in the list, the last item, and the current item. It doesn't scale O(N)

atomiks avatar Jun 17 '25 12:06 atomiks

Bundle size report

Total Size Change: 🔺+1.91KB(+0.13%) - Total Gzip Change: 🔺+472B(+0.10%) Files: 41 total (0 added, 0 removed, 10 changed)

Show details for 41 more bundles

@base-ui-components/reactparsed: 🔺+380B(+0.12%) gzip: 🔺+69B(+0.07%) @base-ui-components/react/menubarparsed: 🔺+216B(+0.98%) gzip: 🔺+63B(+0.79%) @base-ui-components/react/navigation-menuparsed: 🔺+216B(+0.25%) gzip: 🔺+55B(+0.19%) @base-ui-components/react/radio-groupparsed: 🔺+215B(+0.97%) gzip: 🔺+55B(+0.67%) @base-ui-components/react/tabsparsed: 🔺+215B(+0.83%) gzip: 🔺+66B(+0.72%) @base-ui-components/react/toggle-groupparsed: 🔺+215B(+1.36%) gzip: 🔺+58B(+0.99%) @base-ui-components/react/toolbarparsed: 🔺+215B(+1.05%) gzip: 🔺+53B(+0.74%) @base-ui-components/react/selectparsed: 🔺+85B(+0.07%) gzip: 🔺+26B(+0.07%) @base-ui-components/react/context-menuparsed: 🔺+74B(+0.07%) gzip: 🔺+14B(+0.04%) @base-ui-components/react/menuparsed: 🔺+74B(+0.06%) gzip: 🔺+13B(+0.03%) @base-ui-components/react/accordionparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/alert-dialogparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/avatarparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/checkboxparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/checkbox-groupparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/collapsibleparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/dialogparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/direction-providerparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/fieldparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/fieldsetparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/formparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/inputparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/merge-propsparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/meterparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/number-fieldparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/popoverparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/preview-cardparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/progressparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/radioparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/scroll-areaparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/separatorparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/sliderparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/switchparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/toastparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/toggleparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/tooltipparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/unstable-no-ssrparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/unstable-use-media-queryparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/use-renderparsed: 0B(0.00%) gzip: 0B(0.00%) @base-ui-components/react/utilsparsed: 0B(0.00%) gzip: 0B(0.00%) Base UI checkboxparsed: 0B(0.00%) gzip: 0B(0.00%)

Details of bundle changes

Generated by :no_entry_sign: dangerJS against 09235fe932ada9371675debbdc91c21269ef7718

mui-bot avatar Jun 17 '25 12:06 mui-bot

TBH I'd just drop it. The checkVisibility function was introduced only last year in Safari, so this would lead to inconsistent results between browsers. Also, checkVisibility returns false when an element has display: contents.

michaldudak avatar Jun 20 '25 14:06 michaldudak