Skip to content

Adds default styles for [popover] #17945

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brandonmcconnell
Copy link
Contributor

@brandonmcconnell brandonmcconnell commented May 9, 2025

This PR addresses existing preflight styles that break the default positioning of popover elements, as well as add some sensible default colors to override those set by the UA by default

  • Restores default centering: Implements margin: auto to maintain the expected centering for popovers.
  • Sensible default colors:
  • Sets color: inherit for more predictable text styles.
  • Sets background-color: transparent for easier customization.

The browser's defaults for these colors are canvastext and canvas color, respectively, which is another option (to allow the UA styles to take precedence), but I think the inherit/transparent styles are more customizable by default, similar to how borders are removed from form controls when Tailwind CSS applies appearance: none to form controls, by default.

Minimal repro: https://play.tailwindcss.com/jjyvteYH0n

@brandonmcconnell brandonmcconnell requested a review from a team as a code owner May 9, 2025 07:42
@philipp-spiess
Copy link
Member

@brandonmcconnell Hey! Thanks for the PR but I do think we should handle [popover] the same as <dialog>. For the latter we've been removing the margin explicitly and even mention it in the upgrade guides: #16372.

For colors and background colors, <dialog> also falls back to the default canvastext/canvas colors right now: https://play.tailwindcss.com/9Y4nGN0Kyk

So I wonder if the move here is to also mention that [popover] has its margin removed in the upgrade guide instead and not make any changes in preflight (these would be considered breaking changes too so landing them requires more care).

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

Successfully merging this pull request may close these issues.

2 participants