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.

`Active` state in components are returning true on element hover

See original GitHub issue

The Active state inside your componenets are returning true when cursor is hovered over the element.

Snippet of code

{({ active }) => (
            <a className={`${active && 'bg-blue-500'}`} href="/account-settings">
              Account settings
            </a>
          )}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Snazziecommented, Oct 27, 2020

I dont think its correct merging these different behaviors into one. 😃

0reactions
morganfeeneycommented, Sep 19, 2022

This is confusing terminology, I was expecting active to mean what it says. FWIW: I’ve ended up on this issue because I was looking for clarification, I don’t think the docs cover it as well as they could.

e.g.

which tells you if the item is currently focused via the mouse or keyboard

No idea what that means

@RobinMalfait What you say here is a better explanation:

We make menu items and listbox options “active” when that specific item is active being hovered (mouse) or active via keyboard shortcuts. You can still use the active:…, focus:…, and hover: tailwind classes if you want. This is just extra state that we expose to make your components more consistent for both keyboard and mouse users.

It could be beneficial for other users to reopen this issue and the docs could be updated as the outcome?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I access a hover state in reactjs? - Stack Overflow
You will want to add handlers for onMouseEnter and onMouseLeave for hover behavior. Save this answer.
Read more >
React onHover Event Handling (with Examples) - Upmostly
When hovering an element, we want to detect the following states for an HTML element: Beginning to hover over an element; Leaving a...
Read more >
Show an Element on Hover in React | bobbyhadz
Track whether the user is hovering over the element in a state variable. Conditionally render the other element based on the state variable....
Read more >
Elements that are hidden when in the hover state come back ...
I hit this bug on a dropdown select component which was keeping the hover state between open->close->open. Changing the keys at the point...
Read more >
Element: mouseover event - Web APIs | MDN
Returns true if the alt key was down when the mouse event was fired. MouseEvent.button Read only. The button number that was pressed...
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