Sitelet https://web.archive.org/web/20210716125903/https://github.com/mui-org/material-ui/issues/27301
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Popper] Arrow does not display correctly on v5-beta.1 #27301

Open
2 tasks done
jaworek opened this issue Jul 15, 2021 · 5 comments
Open
2 tasks done

[Popper] Arrow does not display correctly on v5-beta.1 #27301

jaworek opened this issue Jul 15, 2021 · 5 comments

Comments

@jaworek
Copy link
Task lists! Give feedback

@jaworek jaworek commented Jul 15, 2021

Arrow in the Popper example does not display correctly in the v5.0-beta documentation.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

There is no arrow displayed and instead there is a black box in its place.

Expected Behavior 🤔

Arrow should be displayed correctly when Popper is enabled.

Steps to Reproduce 🕹

Reproduction:
https://codesandbox.io/s/recursing-shannon-rotlg?file=/src/Demo.tsx

v5 documentation with an arrow bug:
https://next.material-ui.com/components/popper/#scroll-playground
image

It looks correctly in the v4 documentation:
https://material-ui.com/components/popper/#scroll-playground
image

Context 🔦

I'm trying to implement a Popper with arrow, but on the newest version it is broken.

Your Environment 🌎

Browser: Brave based on Chrome 91

This issue can be reproduced in any environment.

@michal-perlakowski
Copy link
Contributor

@michal-perlakowski michal-perlakowski commented Jul 15, 2021

It seems that it broke during migration to emotion. Now referencing the arrow with $arrow now longer works, so the styles are not applied.

@jaworek
Copy link
Author

@jaworek jaworek commented Jul 16, 2021

@michal-perlakowski I implemented Popper styles in my project using scss modules instead of Emotion and the problem persists. It seems that styling needs to be updated to fix this issue. I'll post a solution, if I find one.

@jaworek
Copy link
Author

@jaworek jaworek commented Jul 16, 2021

It looks like is not detected and applied to the Popper and Arrow. When I copied styles manually to arrow, it looks correctly.

@mnajdova
Copy link
Member

@mnajdova mnajdova commented Jul 16, 2021

Taking a look

@mnajdova mnajdova self-assigned this Jul 16, 2021
@mnajdova
Copy link
Member

@mnajdova mnajdova commented Jul 16, 2021

This diff should fix it:

--- a/docs/src/pages/components/popper/ScrollPlayground.js
+++ b/docs/src/pages/components/popper/ScrollPlayground.js
@@ -18,7 +18,7 @@ import FormGroup from '@material-ui/core/FormGroup';

 const Popper = styled(MuiPopper)(({ theme }) => ({
   zIndex: 1,
-  '&[data-popper-placement*="bottom"] $arrow': {
+  '&[data-popper-placement*="bottom"] .MuiPopper-arrow': {
     top: 0,
     left: 0,
     marginTop: '-0.9em',
@@ -29,7 +29,7 @@ const Popper = styled(MuiPopper)(({ theme }) => ({
       borderColor: `transparent transparent ${theme.palette.background.paper} transparent`,
     },
   },
-  '&[data-popper-placement*="top"] $arrow': {
+  '&[data-popper-placement*="top"] .MuiPopper-arrow': {
     bottom: 0,
     left: 0,
     marginBottom: '-0.9em',
@@ -40,7 +40,7 @@ const Popper = styled(MuiPopper)(({ theme }) => ({
       borderColor: `${theme.palette.background.paper} transparent transparent transparent`,
     },
   },
-  '&[data-popper-placement*="right"] $arrow': {
+  '&[data-popper-placement*="right"] .MuiPopper-arrow': {
     left: 0,
     marginLeft: '-0.9em',
     height: '3em',
@@ -50,7 +50,7 @@ const Popper = styled(MuiPopper)(({ theme }) => ({
       borderColor: `transparent ${theme.palette.background.paper} transparent transparent`,
     },
   },
-  '&[data-popper-placement*="left"] $arrow': {
+  '&[data-popper-placement*="left"] .MuiPopper-arrow': {
     right: 0,
     marginRight: '-0.9em',
     height: '3em',
@@ -215,7 +215,7 @@ export default function ScrollPlayground() {
                 },
               ]}
             >
-              {arrow ? <Arrow ref={setArrowRef} /> : null}
+              {arrow ? <Arrow ref={setArrowRef} className="MuiPopper-arrow" /> : null}
               <Paper sx={{ maxWidth: 400, overflow: 'auto' }}>
                 <DialogTitle>{"Use Google's location service?"}</DialogTitle>
                 <DialogContent>

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants