-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[v3] reduce global style conflicts with external components #3154
[v3] reduce global style conflicts with external components #3154
Conversation
🦋 Changeset detectedLatest commit: 46a4aa1 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@87xie is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@87xie thank you for your amazing PRs, I will review/merge them when will have some free time 🚀
I will make some modifications for fewer changes and better consistency, so I have turned it back to a draft. 🙏 |
@87xie I am OOO currently and will go to the graphql conf next week, will review once will have some free time |
Thanks for letting me know! No rush. I’ll go ahead and close this PR for now and split the content into separate PRs. This should make it easier to review and help avoid conflicts. |
Description
Hi teams,
I've referenced the following issues: #2613, #2764, and #3099. This change aims to reduce conflicts with outer-land styles and components.
I introduce cascade layers that unlayered styles can take precedence over Nextra's predefined styles. This approach seems to resolve issues like #747 (comment). At the same time, it prevents Nextra's unlayered styles from inadvertently overriding user-defined CSS layers.
The current priority order is as follows:
nextra-utilities
(highest)nextra-components
nextra-base
(lowest)To avoid conflicts with the focus-visible style in external components, I added a
nextra-focus-ring
class to replace the original element selector. Users can choose in the theme config'sfocusRing
option whether to apply it to all elements or selectively opt out using thenot-nextra-focus-ring
class name.As shown in the image below, when the
focusRing
option isfalse
, the focus-visible style comes from the user agent settings.I believe this modification is more aligned with the design system docs. As seen with kuma-ui, some components are currently affected by Nextra's focus ring, which might confuse some users.
Feel free to close this if the approach is not suitable.