Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Close New Rule dropdown on inline editor close or editor resize #6056

Merged
merged 3 commits into from
Dec 3, 2013

Conversation

redmunds
Copy link
Contributor

This is for #6005

With this change, the New Rule button dropdown list is now dismissed for these additional cases:

  1. Close button (x) is clicked
  2. Host editor is resized.

@ghost ghost assigned njx Nov 25, 2013
@redmunds
Copy link
Contributor Author

redmunds commented Dec 2, 2013

@njx I'm back and waiting for review comments on this pull request.

dropdownEventHandler = new DropdownEventHandler($dropdown, _onSelect, _cleanupDropdown);
dropdownEventHandler.open();

$dropdown.focus();

$(hostEditor).on("scroll", _onScroll);
$("html").on("click", _closeDropdown);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if we do this for other dropdowns, but I wonder if it would be better to add a capture handler to html for this case. That would make it so we don't have to special-case things like clicking on the close button. With this implementation, we don't end up closing the dropdown until after the inline editor animates closed, which looks a little funny. It also means that there might be other cases where we don't close the dropdown (i.e., if you click on some other element that stops propagation in its click handler).

I guess the other question to ask is why the click handler in the close button on the inline editor stops propagation. @RaymondLim - I think you reviewed that code originally - do you know why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. This now closes dropdown before (at same time as) inline editor closes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted that commit.

Note: that code did not change as a part of this pull request -- I only moved that line to group the event handlers together.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could still have the capture handler - it just has to check if the event target is in the dropdown, and if so, don't handle it. But yeah, we can handle that as a separate low-pri bug.

@njx
Copy link
Contributor

njx commented Dec 3, 2013

Reviewed. I would be fine merging this as-is, but just wanted to raise the questions in the comment above. Perhaps the more general question (about how we deal with clicks closing the dropdown) should be handled as part of the popup management cleanup we haven't gotten around to yet: https://trello.com/c/o7jf6s6W

@redmunds
Copy link
Contributor Author

redmunds commented Dec 3, 2013

Ready for re-review.

@njx
Copy link
Contributor

njx commented Dec 3, 2013

Oops...that doesn't seem to work because now clicks within the dropdown itself aren't handled.

@redmunds
Copy link
Contributor Author

redmunds commented Dec 3, 2013

Doh -- I guess i didn't test that. I reverted that commit.

njx added a commit that referenced this pull request Dec 3, 2013
Close New Rule dropdown on inline editor close or editor resize
@njx njx merged commit 7b4e768 into master Dec 3, 2013
@njx
Copy link
Contributor

njx commented Dec 3, 2013

Merged. I'll file a separate issue on using a capture handler.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants