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

Tab activated events are fired on closing a tab with X button #1452

Closed
duncsully opened this issue Jan 2, 2019 · 6 comments · Fixed by #6355
Closed

Tab activated events are fired on closing a tab with X button #1452

duncsully opened this issue Jan 2, 2019 · 6 comments · Fixed by #6355
Assignees
Labels
type: bug 🐛 [3] Velocity rating (Fibonacci)

Comments

@duncsully
Copy link

Describe the bug
It appears that any time a tab is closed via clicking the X, the activated events (before and after included) fire before the delete, and the event target is the tab set container, so I don't really have anyway of knowing that this activation event came from a deletion.

To Reproduce

  1. Navigate to http://master-enterprise.demo.design.infor.com/components/tabs/example-dismissible-tabs.html
  2. Open debugger
  3. In console, enter: $('#tabs-dismissible').on('activated close', console.log)
  4. Close any tab via clicking X
  5. Notice that an activated event fires before the close event (in addition to the activated event that happens after the close to select a new tab), this happens regardless if tab was already selected before removal

Expected behavior
A. The first set of activated events don't fire at all.
B. If not that, then I'd like some reliable way to know to selectively ignore it in my activated handlers.

Version
Appears to be happening in 4.11 and the latest 4.15 dev (likely everything in between)

Platform

  • OS Version: Windows 10
  • Browser Name: Chrome
  • Browser Version: Version 71.0.3578.98 (Official Build) (64-bit)
@tmcconechy tmcconechy added type: bug 🐛 [3] Velocity rating (Fibonacci) labels Jan 2, 2019
@tmcconechy
Copy link
Member

If closing a tab - activate should not fire for that tab.

@tmcconechy
Copy link
Member

Descoping this issue for now. Its not totally incorrect since when you click the tab it activates first as your clicking it as well as the close button

@aaronpikkarainen
Copy link
Contributor

Hi @tmcconechy, can we reopen this issue? It is causing problems for my team (with regard to logic that runs when activating a tab). I was about to open a new issue for this exact problem today, but then I found this closed issue.

If a user clicks the X icon, their intention is to close the tab (not activate it). It's strange that the tab becomes active for a split second right before getting closed.

Note: the problem does not occur when closing a tab that is in the overflow menu.

Thanks!

@tmcconechy
Copy link
Member

yeah i suppose i agree - i was looking at the functionality of it not the events. we can add it back to the backlog

@tmcconechy tmcconechy reopened this Mar 23, 2022
@tmcconechy tmcconechy added this to Triage in Enterprise (Next) Sprint Grooming via automation Mar 23, 2022
@aaronpikkarainen
Copy link
Contributor

aaronpikkarainen commented Mar 23, 2022

Suggested Fix:

tabs.js - lines 798-802

// let right click and close icon click pass through
if (e.which !== 3 && !$(e.target).hasClass('close')) {
  return self.handleTabClick(e, $(this));
}
return false;

Note: I have not fully tested this fix, but it seems good based on my limited testing.

@tmcconechy tmcconechy added this to To do in Enterprise 4.63.x (Apr 2022) Sprint via automation Apr 6, 2022
@ericangeles ericangeles self-assigned this Apr 25, 2022
@ericangeles ericangeles moved this from To do to In progress in Enterprise 4.63.x (Apr 2022) Sprint Apr 27, 2022
@ericangeles ericangeles moved this from In progress to Pending Review in Enterprise 4.63.x (Apr 2022) Sprint Apr 27, 2022
@ericangeles ericangeles moved this from Pending Review to Ready for QA (beta) in Enterprise 4.63.x (Apr 2022) Sprint Apr 28, 2022
@jbrcna
Copy link
Contributor

jbrcna commented Apr 29, 2022

@jbrcna jbrcna moved this from Ready for QA (beta) to Done in Enterprise 4.63.x (Apr 2022) Sprint Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 [3] Velocity rating (Fibonacci)
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

7 participants