Skip to content

:has pseudo selector not working properly on hover #750

Closed
@nlhkabu

Description

@nlhkabu

Bug description

I have an interface where I have items nested inside other items.

Each item has a handle for drag and drop (on the left) and a menu (on the right).

i want to show the handle and menu on hover, but only for the item that I am directly hovering on, not it's parent (or parents)

This is working well on Chrome (without polyfill):

Screenshot from 2022-12-12 11-06-10

But this is what I get with Firefox (107):
Screenshot from 2022-12-12 11-06-09

My setup

package.json

"postcss-preset-env": "8.0.0-alpha.1",

index.html

<script src="https://unpkg.com/css-has-pseudo@4.0.1/dist/browser-global.js"></script>
<script>cssHasPseudo(document)</script>

postcss.config.js

const postcssPresetEnv = require("postcss-preset-env");

module.exports = {
  plugins: [
    postcssPresetEnv({
      features: {
        "nesting-rules": true,
        "has-pseudo-class": true,
      },
    }),
  ],
};

Source CSS

.draggable:hover:not(:has(.nested-list:hover)) {
  & > .entry .grabber {
    display: flex;
  }

  & > .entry .entry-menu {
    display: inline;
  }
}

Expected CSS

??

Actual CSS

??

Does it happen with npx @csstools/csstools-cli <plugin-name> minimal-example.css?

N/A

Debug output

No response

Extra config

No response

What plugin are you experiencing this issue on?

CSS Has Pseudo

Plugin version

8.0.0-alpha.1

What OS are you experiencing this on?

Linux

Node Version

v16.15.1

Validations

  • Follow our Code of Conduct
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this bug?

  • I'm willing to open a PR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions