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

Select-only Combobox Example: Fix scroll event listener bug #2723

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions content/patterns/combobox/examples/js/select-only.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ Select.prototype.init = function () {

// add event listeners
this.comboEl.addEventListener('blur', this.onComboBlur.bind(this));
this.listboxEl.addEventListener('focusout', this.onComboBlur.bind(this));
this.comboEl.addEventListener('click', this.onComboClick.bind(this));
this.comboEl.addEventListener('keydown', this.onComboKeyDown.bind(this));

Expand Down Expand Up @@ -239,10 +240,9 @@ Select.prototype.getSearchString = function (char) {
return this.searchString;
};

Select.prototype.onComboBlur = function () {
// do not do blur action if ignoreBlur flag has been set
if (this.ignoreBlur) {
this.ignoreBlur = false;
Select.prototype.onComboBlur = function (event) {
// do nothing if relatedTarget is contained within listboxEl
if (this.listboxEl.contains(event.relatedTarget)) {
return;
}

Expand Down