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.

Option under mouse is focused when scrolling with ArrowUp/Down

See original GitHub issue

Replicate by clicking the first select on the demo page, putting your mouse cursor over the first option, and pressing ArrowDown. When you get to the bottom of the visible window and ArrowDown once more, the window scrolls causing the mouseEnter handler to fire on the top option and focus goes from Tasmania (which just scrolled into view) back up to the top option.

They way I’ve seen this handled is to keep a flag that tells whether or not the user is using the keyboard on the component, and then check it in the mouseEnter handler. Would look something like this:

var ex = {
    usingKeyboardOn: function() {
        if (this.usingKeyboard) { return; }
        document.removeEventListener("keydown", this.usingKeyboardOn, true);
        document.addEventListener("wheel", this.usingKeyboardOff, true);
        document.addEventListener("mousemove", this.usingKeyboardOff, true);
        this.usingKeyboard = true;
    },
    usingKeyboardOff: function() {
        if (!this.usingKeyboard) { return; }
        document.addEventListener("keydown", this.usingKeyboardOn, true);
        document.removeEventListener("wheel", this.usingKeyboardOff, true);
        document.removeEventListener("mousemove", this.usingKeyboardOff, true);
        this.usingKeyboard = false;
    },
    handleMouseEnter: function(op) {
        if (!this.usingKeyboard) { this.focusOption(op); }
    },
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
hikeebacommented, Apr 4, 2018

Is there any update on this? We are seeing this issue as well and it would be nice to get a solution in without having to work around it.

0reactions
geraldodevcommented, Oct 19, 2016

@FossiFoo,

It’s not completed. I got multi selection and simple selection implemented. Simple-value and Async are not implemented. I have not decided yet to open, because different from @JedWatson I have no authority over the code. I’m porting (a lot of work) and I’m gaining confidence and getting to know the design.

regards, geraldodev

2016-10-19 3:42 GMT-02:00 FossiFoo notifications@github.com:

@geraldodev https://github.com/geraldodev ah, very cool. will you release that? i’ve been looking to do that too, but it was never high enough prio for me.

The suggested fix LGTM as well.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JedWatson/react-select/issues/48#issuecomment-254715596, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvRCEIUY2dqBlukGnCTO3abNFrImOi4ks5q1a2vgaJpZM4DTkif .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scroll Inactive Windows by Hovering Over Them - groovyPost
To enable scrolling inactive windows, open Settings > Devices > Mouse & Touchpad. From there toggle on Scroll inactive windows when I hover...
Read more >
How to make the scroll wheel to affect always what's under the ...
Select this and look for the option to "Activate a window by hovering over it with the mouse". Now the window under the...
Read more >
How to focus to splited screens when moving mouse cursor to ...
Currently the mouse and screen if focused in the splitted screen named as SPLITTED SCREEEN ONE and i have tried to scroll to...
Read more >
c++ - Scrolling the Window Under the Mouse - Stack Overflow
And now, the window under your mouse will always get scroll messages, and not the focused window. Share.
Read more >
How to Enable Inactive Scrolling on Windows 10 - MakeUseOf
Windows 10 can scroll through windows even if you don't click on them to bring them into focus first. Using a computer mouse....
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