Skip to content

Don't add cursor: pointer to vars when variable highlighting is inactive #4870

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 2 commits into
base: main
Choose a base branch
from

Conversation

twiss
Copy link

@twiss twiss commented Jan 8, 2025

In exported documents, variable highlighting is inactive, and clicking on vars doesn't do anything. So, I think we shouldn't set cursor: pointer on them.

This seems to possibly have been a mistake and only intended for variables with a data type hover bubble, but even there, clicking on them doesn't do anything so setting cursor: pointer on them still doesn't particularly make sense, IMHO.

For non-exported documents when highlighting is active, src/styles/var.css.js will still set cursor: pointer, so this shouldn't break that case.

@sidvishnoi sidvishnoi self-requested a review January 8, 2025 17:01
@sidvishnoi
Copy link
Member

sidvishnoi commented Jan 10, 2025

Thanks for the PR @twiss.
I'm wondering if we should instead support var highlighting on generated docs: #3765.

Just to clear my understanding: With var highlighting on, I think we agree we should continue showing cursor: pointer. But if there's vars outside highlighting, even if they have data-type, I think there's no reason to show pointer?

@twiss
Copy link
Author

twiss commented Jan 12, 2025

I think #3765 would be a great addition, yeah, though I think it's in principle orthogonal from this change indeed in the sense that that change should be made in src/core/highlight-vars.js (by removing the removeOnSave, among other things), whereas this file could/should still be changed in the exact same way (although the effect will be less visible, it'll just remove a redundant CSS rule at that point).

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the cursor: pointer CSS property from var elements that don't have interactive functionality in exported documents, improving the user experience by avoiding misleading cursor behavior.

  • Restricts the positioning CSS rule to only apply to var elements with a data-type attribute
  • Removes the cursor: pointer property entirely from the datatype CSS module
  • Relies on the existing var.css.js module to handle cursor styling for interactive variable highlighting

@@ -3,9 +3,8 @@ const css = String.raw;
// Prettier ignore only to keep code indented from level 0.
// prettier-ignore
export default css`
var {
var[data-type] {
Copy link
Preview

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSS selector change from var to var[data-type] may create inconsistency if the position: relative property is needed for all var elements, not just those with data-type attributes. Consider whether this positioning change could affect the layout of var elements without data-type attributes.

Suggested change
var[data-type] {
var {

Copilot uses AI. Check for mistakes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed, the position: relative is only to help position the position: absolute ::before and ::after pseudoelements below.

Copy link

netlify bot commented Aug 6, 2025

Deploy Preview for respec-pr ready!

Name Link
🔨 Latest commit 27f41d6
🔍 Latest deploy log https://app.netlify.com/projects/respec-pr/deploys/6892f0b5ddc184000875cf57
😎 Deploy Preview https://deploy-preview-4870--respec-pr.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

3 participants