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

Component: TabMenu - field visible #12823

Closed
marcosmvrg opened this issue Mar 27, 2023 · 0 comments · Fixed by #12828
Closed

Component: TabMenu - field visible #12823

marcosmvrg opened this issue Mar 27, 2023 · 0 comments · Fixed by #12828
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@marcosmvrg
Copy link

Describe the bug

In the documentation the field visible of TabMenu -> TabMenuItem says:
image

Whether the dom element of menuitem is created or not.

But actually the menu item is "removed" by using a display: none called by .p-hidden css class.

I believe the correct behavior of this should be an ngif inside of the li tag and move the ngFor to be outside using a ng-container:

 <ul #navbar class="p-tabmenu-nav p-reset" role="tablist">
<ng-container *ngFor="let item of model; let i = index">
                        <li
                            *ngIf="item.visible"
                            role="tab"
                            [ngStyle]="item.style"
                            [class]="item.styleClass"
                            [attr.aria-selected]="isActive(item)"
                            [attr.aria-expanded]="isActive(item)"
                            [ngClass]="{ 'p-tabmenuitem': true, 'p-disabled': item.disabled, 'p-highlight': isActive(item) }"
                            pTooltip
                            [tooltipOptions]="item.tooltipOptions"
                        >
...

also because of this aproach, the p-hidden isn't working because another css class provide by the .p-tabmenuitem is aplying a display flex and the p-hidden is not an important css class.

image

src/app/components/tabmenu/tabmenu.css line 77.
src/app/components/common/common.css line 6.

I saw in the version 15.0.1 the bug was fixed by removing the .p-tabmenuitem { display: flex; } but i believe the correct fix should be using a ngif instead.

Environment

Angular 15.1.0
Primeng 15.1.1

Reproducer

https://stackblitz.com/edit/github-xbqxur

Angular version

15.1.0

PrimeNG version

15.1.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.14.2

Browser(s)

Chrome 111, Firefox 108, Edge 111

Steps to reproduce the behavior

1 - Create a tabmenu and put some itens menus using the visible true or false
2 - Notice the menu-item with the visible false isn't remove from the DOM.

Expected behavior

the menu-item with the tag visible === false should be remove from the DOM.

@marcosmvrg marcosmvrg added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 27, 2023
@marcosmvrg marcosmvrg changed the title Component: TabMenu field visible Component: TabMenu - field visible Mar 27, 2023
volvachev added a commit to volvachev/primeng that referenced this issue Mar 28, 2023
@cetincakiroglu cetincakiroglu added this to the 15.3.1 milestone Apr 12, 2023
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants