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

Close EuiComboBox options when the page scrolls #2106

Merged

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Jul 11, 2019

Summary

Fixes #2099 by auto-closing the combo box's options popover on scroll events.

I modified the first combo box example to the following for this within a scrollable container

  render() {
    const { selectedOptions } = this.state;
    return (
      <div>
        <div style={{
          height: '200px',
          overflowY: 'scroll'
        }}>
          <div style={{height: '50px'}}/>
          <EuiComboBox
            placeholder="Select or create options"
            options={this.options}
            selectedOptions={selectedOptions}
            onChange={this.onChange}
            onCreateOption={this.onCreateOption}
            isClearable={true}
            data-test-subj="demoComboBox"
          />
          <div style={{height: '500px'}}/>
        </div>
      </div>
    );
  }

Checklist

  • This was checked in mobile
  • This was checked in IE11
    - [ ] This was checked in dark mode
    - [ ] Any props added have proper autodocs
    - [ ] Documentation examples were added
  • A changelog entry exists and is marked appropriately
  • This was checked for breaking changes and labeled appropriately
    - [ ] Jest tests were updated or added to match the most common scenarios
    - [ ] This was checked against keyboard-only and screenreader scenarios
    - [ ] This required updates to Framer X components

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Tested in Chrome 👍
Tested in Fireforx 🆗 There's a bit of a lag before it will disappear but it's better than the alternative.

@chandlerprall
Copy link
Contributor Author

There's a bit of a lag before it will disappear but it's better than the alternative.

Happens occasionally in some browsers besides Firefox, unfortunately that's from the browsers not emitting scroll events quickly, which is done for performance reasons :-/

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Tested in Firefox, Chrome, Safari, IE11, and Edge.

Saw the lag, also, but otherwise 👍

Looks like a snapshot needs updating. CL, too.

@chandlerprall chandlerprall merged commit e7662e3 into elastic:master Jul 15, 2019
@chandlerprall chandlerprall deleted the bug/2099-scrolling-combobox-options branch July 15, 2019 16:17
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.

EuiComboBox menu not scrolling with input when page is scrolled
3 participants