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

PrimeNG 16.1.0 selecting a menu option causes panel to scroll #13390

Closed
rosenthalj opened this issue Jul 27, 2023 · 1 comment · Fixed by #13608
Closed

PrimeNG 16.1.0 selecting a menu option causes panel to scroll #13390

rosenthalj opened this issue Jul 27, 2023 · 1 comment · Fixed by #13608
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@rosenthalj
Copy link
Contributor

rosenthalj commented Jul 27, 2023

Describe the bug

A problem with Menubar and other PrimeNG "menu" components was introduced in PrimeNG 16.1.0.

When a Menubar option is selected and a horizontal scroll bar is present, the menubar will scroll so that the corresponding option or parent option is at the beginning of the visible region. This same problem occurs in other PrimeNG "menu" components like MegaMenu

The first movie demonstrates when a Menubar's root menu option is selected:

MenuBarBugPart1.mov

The second movie demonstrates when a MenuBar's child menu option is selected:

MenuBarBugPart2.mov

The third movie demonstrates when a MegaMenu's child menu option is selected:

MegaMenuBarBug.mov

The forth movie demonstrates when a TieredMenu's root and child menu options iare selected:

TieredMenuBug.mov

Environment

Mac OS and Windows

Reproducers

Menubar: https://stackblitz.com/edit/vyzu1j?file=package.json
MegaMenu: https://stackblitz.com/edit/3hyz2s?file=package.json
TieredMenu: https://stackblitz.com/edit/buqxye?file=package.json

Angular version

16.x

PrimeNG version

16.1.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.16.0

Browser(s)

chrome, safari, firefox

Steps to reproduce the behavior

MenuBar

  1. Run the stackblitz Menubar reproducer
  2. Expand the stackblitz window so that all 5 menubar options are visible
  3. Make sure the horizontal scroll bar is scrolled completely to the left
  4. Click on a menu option (like "Quit" or "Users > New")
  5. See that the panel automatically scrolls and the selected option (or its parent option) is at the start of the scroll region

MegaMenu
Follow similar steps as above with the stackblitz MegaMenu reproducer

TieredMenu
Follow similar steps as above with the stackblitz TieredMenu reproducer

Expected behavior

After executing step 4, the panel should not scroll.

@rosenthalj rosenthalj added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 27, 2023
@rosenthalj rosenthalj changed the title In v16.1.0 selecting a MenuBar menu options causes panel to scroll In v16.1.0 selecting a MenuBar menu option causes panel to scroll Jul 27, 2023
@rosenthalj rosenthalj changed the title In v16.1.0 selecting a MenuBar menu option causes panel to scroll PrimeNG 16.1.0 selecting a menu option causes panel to scroll Jul 28, 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 Jul 28, 2023
@cetincakiroglu cetincakiroglu added this to the 16.1.1 milestone Jul 28, 2023
@biswasSaumyadip
Copy link
Contributor

biswasSaumyadip commented Jul 29, 2023

Can anybody explain why scrollIntoView was introduced?

`
scrollInView (index: number = -1) {

    const id = index !== -1 ? `${this.id}_${index}` : this.focusedItemId;
    const element = DomHandler.findSingle(this.rootmenu.el.nativeElement, `li[id="${id}"]`);

    if (element) {
        element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'begin' });
    }
}`

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.

3 participants