question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Popper arrow doesn't respect theme

See original GitHub issue
  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

When configuring the Popper component to display a pointer arrow, I expect the arrow will respond to theme changes, e.g. If my application is using a light theme I expect the Popper body and arrow to be white (in my case), however in dark mode the arrow remains white, despite the body of the Popper updating to black/grey.

Current Behavior 😯

Changing from light to dark theme does not update the Popper arrow, it remains white as in the light theme.

Steps to Reproduce 🕹

The issue can be reproduced via the live example in the MUI docs

  1. Using the scroll playground example, configure the popper to display a pointer arrow
  2. Switch the site to use the dark theme
  3. Open the popper in the scroll playground example
  4. Note the colour of the pointer arrow

Your Environment 🌎

Tech Version
Material-UI v4.1.3
React v16.8.6
Browser Chrome
TypeScript Not used

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fraser-mcmillancommented, Jul 10, 2019

Absolutely, will do @oliviertassinari !

1reaction
oliviertassinaricommented, Jul 10, 2019

@fraser-mcmillan Thanks for the report. The arrow color is hard-coded. What do you think of?

diff --git a/docs/src/pages/components/popper/ScrollPlayground.js b/docs/src/pages/components/popper/ScrollPlayground.js
index b3d522cf4..8a5ca75f4 100644
--- a/docs/src/pages/components/popper/ScrollPlayground.js
+++ b/docs/src/pages/components/popper/ScrollPlayground.js
@@ -51,7 +51,7 @@ const styles = theme => ({
       height: '1em',
       '&::before': {
         borderWidth: '0 1em 1em 1em',
-        borderColor: `transparent transparent ${theme.palette.common.white} transparent`,
+        borderColor: `transparent transparent ${theme.palette.background.paper} transparent`,
       },
     },
     '&[x-placement*="top"] $arrow': {
@@ -62,7 +62,7 @@ const styles = theme => ({
       height: '1em',
       '&::before': {
         borderWidth: '1em 1em 0 1em',
-        borderColor: `${theme.palette.common.white} transparent transparent transparent`,
+        borderColor: `${theme.palette.background.paper} transparent transparent transparent`,
       },
     },
     '&[x-placement*="right"] $arrow': {
@@ -72,7 +72,7 @@ const styles = theme => ({
       width: '1em',
       '&::before': {
         borderWidth: '1em 1em 1em 0',
-        borderColor: `transparent ${theme.palette.common.white} transparent transparent`,
+        borderColor: `transparent ${theme.palette.background.paper} transparent transparent`,
       },
     },
     '&[x-placement*="left"] $arrow': {
@@ -82,7 +82,7 @@ const styles = theme => ({
       width: '1em',
       '&::before': {
         borderWidth: '1em 0 1em 1em',
-        borderColor: `transparent transparent transparent ${theme.palette.common.white}`,
+        borderColor: `transparent transparent transparent ${theme.palette.background.paper}`,
       },
     },
   },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Popper arrow doesn't respect theme · Issue #16545 - GitHub
Using the scroll playground example, configure the popper to display a pointer arrow · Switch the site to use the dark theme ·...
Read more >
Example of using arrow in Popper component of material-ui
Make a styled Popper, as Popper doesn't support sx prop. const StyledPopper = styled(Popper)(({ theme }) => ({ ...
Read more >
React Popper component - Material UI - MUI
This component should respect the following conditions: Be a direct child descendent of the popper. Call the onEnter callback prop when the enter...
Read more >
Arrow | Popper
The arrow modifier positions an inner element of the popper so it appears centered relative to the reference element, usually the triangle or...
Read more >
Notes | Time's Arrow & Archimedes' Point: New Directions for the ...
Even if it is an option with respect to the traditional secondary qualities, it may not be with respect to other concepts, which—though...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found