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

Customizing Toolbar Can Overflow Without Creating Dropdown #7000

Open
IanKrL opened this issue Jan 25, 2024 · 5 comments · May be fixed by #7012
Open

Customizing Toolbar Can Overflow Without Creating Dropdown #7000

IanKrL opened this issue Jan 25, 2024 · 5 comments · May be fixed by #7012
Labels
kind:bug Bug report or fix Platform [ci] enable platform tests (platform/*) UI User Interface

Comments

@IanKrL
Copy link

IanKrL commented Jan 25, 2024

Apache NetBeans version

Apache NetBeans 20

What happened

When using the Customize Toolbars feature, if the Netbeans window is just larger than the existing toolbars, adding a new toolbar button can cause the buttons to overflow out of the window (the right-most buttons are not displayed) rather than converting to a dropdown as they should.

I suspect there is a slight miscalculation somewhere or an event getting lost such that it doesn’t think it needs the overflow dropdown.

Language / Project Type / NetBeans Component

All

How to reproduce

Launch netbeans
Make not fullscreen
Create a new project (I used the default reactjs)
Select View->Toolbars->Use Small Icons
Select View->Toolbars-> <Select all toolbars>
Select View->Toolbars->Customize
Move Performance to the far-right of the toolbar space
Resize the window so it's just wider than the existing toolbar buttons so they all just barely fit.
Add a new icon from the Customize Toolbar window into the Performance toolbar.

At this point the existing far-right button slides off the screen, rather than becoming a dropdown as it should. If it works correctly, remove the icon you just added and slightly adjust the width of the window. Try different widths until it fails. Once you have the right window width it should be reliably reproducible, but only certain widths will fail.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows 10 Pro 22H2

JDK

openjdk 17.0.8 2023-07-18

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

I have been unable to reproduce this problem on Linux. It can be frustrating to reproduce because it will work properly for most window widths, but get it just right and it fails every time.

Are you willing to submit a pull request?

No

@IanKrL IanKrL added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Jan 25, 2024
@IanKrL
Copy link
Author

IanKrL commented Jan 25, 2024

nbtoolbar-2024-01-25_09.14.59.mp4

This video shows it happening.

@neilcsmith-net
Copy link
Member

Does this happen with an alternative Look and Feel? Be good to know if it's specific to FlatLaf on Windows.

@IanKrL
Copy link
Author

IanKrL commented Jan 25, 2024

I can reproduce with Metal and Nimbus as well. It seems that for Metal the affected window width was the same as FlatLaf, but for Nimbus I had to resize the window slightly to see the failure.

Once you've seen the failure, then add several more icons, resizing the window causes the toolbar to immediately change to the dropdown. However, if you put the size back to where it was before (at the failing width) then removing an icon can also trigger the failure (icons are hidden off the edge of the screen).

3 people in my company have been able to reproduce this failure all on different machines.

@mbien mbien added UI User Interface and removed needs:triage Requires attention from one of the committers labels Jan 27, 2024
@mbien
Copy link
Member

mbien commented Jan 29, 2024

the overflow mechanism of the toolbar is only updated when the toolbar is resized. This works most of the time since adding/removing buttons does resize the toolbar, unless it is modified when it already overflows.

The obvious way of fixing this would be to update the overflow when something is added/removed, but the current implementation rebuilds the whole toolbar when something is added/removed and the overflow mechanism itself adds/removes components too. So this is not going to work.

I have a working version which uses invalidate() and rebuilds the toolbar in doLayout() if it is invalid, but I don't like the impl tbh.Toolbars are also used everywhere, there is a risk that this will break something.

@mbien mbien linked a pull request Jan 29, 2024 that will close this issue
@mbien
Copy link
Member

mbien commented Jan 29, 2024

linked a draft PR targeting NB 22 - I think this might work.

@mbien mbien added the Platform [ci] enable platform tests (platform/*) label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix Platform [ci] enable platform tests (platform/*) UI User Interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants