Skip to content

Conversation

@chintankavathia
Copy link
Member

added SiTabComponent.canActivate and SiTabComponent.canDeactivate to control activation/deactivation of tabs similar to angular router guards.

@github-actions
Copy link

@chintankavathia chintankavathia marked this pull request as ready for review September 12, 2025 07:06
@chintankavathia chintankavathia requested a review from a team as a code owner September 12, 2025 07:06
@timowolf timowolf self-assigned this Sep 15, 2025
@timowolf timowolf added the enhancement Topics that make the project better label Sep 15, 2025
Copy link
Member

@timowolf timowolf left a comment

Choose a reason for hiding this comment

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

Many thanks, while the implementation is great, can you please also add the canActivate to the example. E.g. Does it make sense to show a tab that cannot be activated? Or should it be hidden @panch1739

Copy link
Member

@timowolf timowolf left a comment

Choose a reason for hiding this comment

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

LGTM

added `SiTabComponent.canActivate` and `SiTabComponent.canDeactivate` to control activation/deactivation of tabs similar to angular router guards.
@timowolf timowolf enabled auto-merge (rebase) September 16, 2025 07:07
@panch1739
Copy link
Member

Many thanks, while the implementation is great, can you please also add the canActivate to the example. E.g. Does it make sense to show a tab that cannot be activated? Or should it be hidden @panch1739

If I understand correctly, when a tab/route is protected by canActivate, the user may click it and nothing happens because they don’t have access. From a UX perspective this feels broken, since the system is silently blocking navigation.

I would suggest:

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf @chintankavathia would that be possible? maybe we can add a short guide?

@timowolf timowolf merged commit 1d33374 into main Sep 16, 2025
9 checks passed
@timowolf timowolf deleted the feat/tabs/guards branch September 16, 2025 07:19
@chintankavathia
Copy link
Member Author

Many thanks, while the implementation is great, can you please also add the canActivate to the example. E.g. Does it make sense to show a tab that cannot be activated? Or should it be hidden @panch1739

If I understand correctly, when a tab/route is protected by canActivate, the user may click it and nothing happens because they don’t have access. From a UX perspective this feels broken, since the system is silently blocking navigation.

I would suggest:

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf @chintankavathia would that be possible? maybe we can add a short guide?

@panch1739 sorry for the confusion. Apps can provide the feedback (e.g navigate to info page or show a toast message etc) when tab is clicked but is protected by canActivate.

@panch1739
Copy link
Member

Many thanks, while the implementation is great, can you please also add the canActivate to the example. E.g. Does it make sense to show a tab that cannot be activated? Or should it be hidden @panch1739

If I understand correctly, when a tab/route is protected by canActivate, the user may click it and nothing happens because they don’t have access. From a UX perspective this feels broken, since the system is silently blocking navigation.
I would suggest:

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf @chintankavathia would that be possible? maybe we can add a short guide?

@panch1739 sorry for the confusion. Apps can provide the feedback (e.g navigate to info page or show a toast message etc) when tab is clicked but is protected by canActivate.

Ann thanks @chintankavathia! Would it be possible to add this sort of guideline somewhere? I think it would be nice to mention that...

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf what do you think?

@chintankavathia
Copy link
Member Author

Many thanks, while the implementation is great, can you please also add the canActivate to the example. E.g. Does it make sense to show a tab that cannot be activated? Or should it be hidden @panch1739

If I understand correctly, when a tab/route is protected by canActivate, the user may click it and nothing happens because they don’t have access. From a UX perspective this feels broken, since the system is silently blocking navigation.
I would suggest:

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf @chintankavathia would that be possible? maybe we can add a short guide?

@panch1739 sorry for the confusion. Apps can provide the feedback (e.g navigate to info page or show a toast message etc) when tab is clicked but is protected by canActivate.

Ann thanks @chintankavathia! Would it be possible to add this sort of guideline somewhere? I think it would be nice to mention that...

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf what do you think?

@panch1739 @timowolf added some explanation here https://github.com/siemens/element/pull/735/files let me know if this works

@panch1739
Copy link
Member

Many thanks, while the implementation is great, can you please also add the canActivate to the example. E.g. Does it make sense to show a tab that cannot be activated? Or should it be hidden @panch1739

If I understand correctly, when a tab/route is protected by canActivate, the user may click it and nothing happens because they don’t have access. From a UX perspective this feels broken, since the system is silently blocking navigation.
I would suggest:

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf @chintankavathia would that be possible? maybe we can add a short guide?

@panch1739 sorry for the confusion. Apps can provide the feedback (e.g navigate to info page or show a toast message etc) when tab is clicked but is protected by canActivate.

Ann thanks @chintankavathia! Would it be possible to add this sort of guideline somewhere? I think it would be nice to mention that...

  • By default, tabs should be hidden when the feature is irrelevant to the user’s role.
  • If there’s a clear reason for the user to see the tab (for example: to request access, or contact an admin), the tab may remain visible. In this case, navigation should still work but lead to a screen with an info page component with something like:
    “You don’t have access to this feature.
    “Contact your administrator to request access.”

@timowolf what do you think?

@panch1739 @timowolf added some explanation here https://github.com/siemens/element/pull/735/files let me know if this works

@chintankavathia amazing! Thank you. Lets hear what Timo thinks ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Topics that make the project better released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants