Skip to content
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

[V2] IE11 bug: Scrollbar arrows scroll menu to the top when using openMenuOnFocus={true} #3342

Closed
afrisone opened this issue Jan 10, 2019 · 1 comment · Fixed by #3402
Closed

Comments

@afrisone
Copy link

Issue:

When using the prop openMenuOnFocus={true}, we cannot use the down arrow under the scroll bar to scroll the menu list down in IE11 (Chrome works fine). I am on react-select version 2.2.0.

My suspicion is that the menu gets refocused after hitting the scrollbar arrows, and with openMenuOnFocus={true}, it's reopening the menu, scrolling to the top.

Repro steps

  1. Create a react-select dropdown with enough options to have a dropdown arrow
  2. Give that react select component a prop openMenuOnFocus={true}
  3. Open the app in IE11 (Chrome works fine)
  4. In the dropdown, try scrolling down hitting the down arrow icon under the scroll bar
  5. Notice that the react-select dropdown keeps scrolling back up to the top

Codesandbox does not seem to work in IE11 right now, so I am attaching my code and a GIF showing the behavior instead. Hope that's ok!

Code:

import React, { Component } from "react";
import Select from "react-select";
import "./App.css";

const options = [
  { value: "chocolate", label: "Chocolate" },
  { value: "strawberry", label: "Strawberry" },
  { value: "vanilla", label: "Vanilla" },
  { value: "chicken", label: "Chicken" },
  { value: "candycorn", label: "CandyCorn" },
  { value: "whiskey", label: "Whiskey" },
  { value: "chocolatewhiskey", label: "ChocolateWhiskey" },
  { value: "strawberrywhiskey", label: "StrawberryWhiskey" },
  { value: "vanillawhiskey", label: "VanillaWhiskey" },
  { value: "coke", label: "Coke" },
  { value: "clock", label: "Clock" },
  { value: "snow", label: "Snow" },
  { value: "nachoflavorbeanchips", label: "nachoflavorbeanchips" }
];

class App extends Component {
  state = {
    selectedOption: null
  };

  handleChange = selectedOption => {
    this.setState({ selectedOption });
  };

  render() {
    const { selectedOption } = this.state;

    return (
      <div className="App">
        <Select
          value={selectedOption}
          onChange={this.handleChange}
          options={options}
          openMenuOnFocus={true}
        />
      </div>
    );
  }
}

export default App;

GIF:

ie11 scroll arrows refocus menulist and wont scroll

@afrisone afrisone changed the title [V2] IE11 bug: Scrollbar arrows break when using openMenuOnFocus={true} [V2] IE11 bug: Scrollbar arrows scroll menu to the top when using openMenuOnFocus={true} Jan 10, 2019
@bradspark
Copy link

I'm having this issue as well

timothypage added a commit to timothypage/react-select that referenced this issue Feb 2, 2019
seems related to 30ead6d, a fix for the MenuList closing when the
scrollbar is clicked in IE11.  When the select input is refocused, the
openMenu method re-scrolls MenuList to the currently selected value,
causing the user to be unable to scroll to other values via mouse click

fixes JedWatson#3342
marianacapelo pushed a commit to OutSystems/react-select that referenced this issue Aug 11, 2021
seems related to 30ead6d, a fix for the MenuList closing when the
scrollbar is clicked in IE11.  When the select input is refocused, the
openMenu method re-scrolls MenuList to the currently selected value,
causing the user to be unable to scroll to other values via mouse click

fixes JedWatson#3342
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 a pull request may close this issue.

2 participants