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

ix-tab "select" logic not working #1655

Open
2 tasks done
marvingreeven opened this issue Jan 20, 2025 · 3 comments
Open
2 tasks done

ix-tab "select" logic not working #1655

marvingreeven opened this issue Jan 20, 2025 · 3 comments
Labels
Contribution welcome 👨‍💻 This issue is open for contributions from the community type: bug Something isn't working Workflow: Issue created JIRA issue is created and will be analyzed

Comments

@marvingreeven
Copy link

Prerequisites

  • I have read the Contributing Guidelines.
  • I have not leaked any internal/restricted information like screenshots, videos, code snippets, links etc.

What happened?

In our application we have a guard which decides if we can switch the application or stay on that site, whether there are unsaved changes.
When we click on a ix-tab-item we have a function, like in the example, but have a check for pending changes before we set the selectedTab.

However we can see that we do not set the selectedTab parameter, but still the new tab is selected and displayed as active.

We have tried the other approaches like "tabClick" or "click", "selected" on ix-tab-item and "selectedChange" function. But the outcome is the same.

In the code example you can see that the content stays on index=1 but the wrong tab is selected.

What type of frontend framework are you seeing the problem on?

Angular

Which version of iX do you use?

v2.6.1

Code to produce this issue.

https://stackblitz.com/edit/gr28jqt2?file=src%2Ftabs.ts
@marvingreeven marvingreeven added the triage We discuss this topic in our internal weekly label Jan 20, 2025
@danielleroux
Copy link
Collaborator

Currently the ix-tab-item has a dedicated tabClick-event, with help of this event you should be able to cancel the default behaviour of the selection e.g:

<ix-tab-item (tabClick)="changeTab($event, 0)">Tab 1</ix-tab-item>

changeTab(event: Event, tabIndex: number) {
    event.preventDefault();
    // only if there are no pending changes, or the user forces the change in a popup, we want to navigate
    if (!this.pendingChanges) {
      // this code is not beeing executet! But IX is still setting the new IX-tab-item to active?
      this.selectedTab = tabIndex;
    }
    console.log('Selected Tab: ' + this.selectedTab);
  }

We will also include the native click event to handle "preventDefault" better.

@danielleroux danielleroux added type: bug Something isn't working Workflow: Issue created JIRA issue is created and will be analyzed Contribution welcome 👨‍💻 This issue is open for contributions from the community and removed triage We discuss this topic in our internal weekly labels Jan 21, 2025
Copy link
Contributor

github-actions bot commented Jan 21, 2025

🤖 Hello @marvingreeven

Your issue will be analyzed and is part of our internal workflow.
To get informed about our workflow please checkout the Contributing Guidelines

JIRA: IX-2295

Copy link
Contributor

Thank you for creating this issue! It has been labeled as Contribution welcome 👨‍💻. This issue is open for contributions from the community.

If you'd like to work on this issue, please comment here letting us know that you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution welcome 👨‍💻 This issue is open for contributions from the community type: bug Something isn't working Workflow: Issue created JIRA issue is created and will be analyzed
Projects
None yet
Development

No branches or pull requests

2 participants