Esri / calcite-design-system

A monorepo containing the packages for Esri's Calcite Design System
https://developers.arcgis.com/calcite-design-system/
Other
269 stars 75 forks source link

[split-button] Drop down items do not fully display using Safari #9419

Open doreenbrinkman opened 1 month ago

doreenbrinkman commented 1 month ago

Check existing issues

Actual Behavior

Calcite split-button does not fully display the dropdown items using the Safari browser.

Safari screenshot: 2024-05-24_15-38-07

Chrome screenshot (working): 2024-05-24_15-37-07

Expected Behavior

All dropdown items are visible

Reproduction Sample

https://github.com/doreenbrinkman/calcite-debug

Reproduction Steps

  1. Clone the reproduction sample and checkout the branch dore582-safari-dropdown
  2. Run the app

Reproduction Version

2.8.3

Relevant Info

MacOS Safari 17.4.1

Regression?

No response

Priority impact

impact - p1 - need for current milestone

Impact

The only workaround is to reduce the width of the window and the dropdown items will re-render above. Changing the overlayPositioning does not help.

Calcite package

Esri team

ArcGIS Online

geospatialem commented 1 month ago

Related https://github.com/Esri/calcite-design-system/issues/8028

jcfranco commented 1 month ago

Here's a codepen version of the repro case: https://codepen.io/jcfranco/pen/ZENpLxd

jcfranco commented 3 weeks ago

It looks like this is a Safari browser bug.

As a workaround, you could unset the header/footer z-index used in modal (see updated example):

calcite-modal {
  --calcite-z-index-header: initial;
}

I'll go ahead and label this as blocked until the browser bug is resolved.

github-actions[bot] commented 3 weeks ago

cc @geospatialem, @brittneytewks

doreenbrinkman commented 3 weeks ago

As a workaround, you could unset the header/footer z-index used in modal (see updated example):

I just tried the workaround in our React/Typescript application (sample above, did not try there but in our app) and it flashed the entire dropdown once and went back to just showing the menu cutoff.

Currently, our workaround is it set the placement of the calcite-split-button dropdown to top-end so it renders above.

if (isSafari) { const dropdown = target?.shadowRoot?.querySelector("calcite-dropdown"); dropdown?.setAttribute("placement", "top-end"); }`

jcfranco commented 3 weeks ago

@doreenbrinkman Would you be able to share more info about dropdown cutoff you're observing?

jcfranco commented 3 weeks ago

@doreenbrinkman Following up on our chat, it looks like my workaround wasn't being applied properly because Vite was injecting the styles afterward, which would override it. Would you mind applying the following to your repro case?

diff --git c/src/main.jsx w/src/main.jsx
index d529fa9..7a1d40e 100644
--- c/src/main.jsx
+++ w/src/main.jsx
@@ -23,12 +23,16 @@ ReactDOM.createRoot(document.getElementById("root")).render(
       widthScale="s"
       open
       outsideCloseDisabled
-      dismissible>
+      dismissible
+      style={{
+        "--calcite-z-index-header": "initial"
+      }}>
         <div slot="header">Safari split button</div>
         <div slot="content">Add some content here</div>
         <CalciteSplitButton
           slot="secondary"
           primaryText="Save and leave"
+          overlayPositioning="fixed"
           scale="m">
           <CalciteDropdownGroup selectionMode="none">
             <CalciteDropdownItem>Save and leave</CalciteDropdownItem>
doreenbrinkman commented 3 weeks ago

The workaround works using either inline styling or using a class. I forgot to pass in overlayPositioning fixed to the calcite-split-button. We are switching to this workaround as it will work with all the browsers. Thanks!